瀏覽代碼

优化弹窗

gavin.chen 2 年之前
父節點
當前提交
d097f6a10f
共有 3 個文件被更改,包括 122 次插入98 次删除
  1. 109 91
      lib/calendar_page/month_calendar/schedule_popup.dart
  2. 3 1
      lib/main.dart
  3. 10 6
      lib/popup_layer/popup_layer.dart

+ 109 - 91
lib/calendar_page/month_calendar/schedule_popup.dart

@@ -34,16 +34,11 @@ class SchedulePopupState extends State<SchedulePopup> {
 
   @override
   Widget build(BuildContext context) {
-    return Material(
-      child: ListView(
-        shrinkWrap: true,
-        children: [
-          Container(
-            padding: const EdgeInsets.all(10),
-            child: _buildScheduleList(),
-          ),
-        ],
-      ),
+    return ListView(
+      shrinkWrap: true,
+      children: [
+        _buildScheduleDetailCard(),
+      ],
     );
   }
 
@@ -64,101 +59,121 @@ class SchedulePopupState extends State<SchedulePopup> {
     required VoidCallback onPressed,
     required IconData icon,
   }) {
-    return IconButton(
-      splashRadius: 20,
-      onPressed: onPressed,
-      icon: _buildIcon(
-        icon: icon,
-        size: 20,
+    return Material(
+      color: Colors.transparent,
+      child: IconButton(
+        splashRadius: 20,
+        onPressed: onPressed,
+        icon: _buildIcon(
+          icon: icon,
+          size: 20,
+        ),
       ),
     );
   }
 
   Map<int, String> weekMap = {
-    1: '星期一',
-    2: '星期二',
-    3: '星期三',
-    4: '星期四',
-    5: '星期五',
-    6: '星期六',
-    7: '星期天',
+    1: '一',
+    2: '二',
+    3: '三',
+    4: '四',
+    5: '五',
+    6: '六',
+    7: '周日',
   };
 
   /// 日程卡片视图列表
-  Widget _buildScheduleList() {
+  Widget _buildScheduleDetailCard() {
     final currentDate = widget.scheduleData.day;
     return Column(
       mainAxisSize: MainAxisSize.min,
       children: [
-        _buildScheduleHeadActionBar(),
-        _buildScheduleLayoutItem(
-          iconWidget: const SizedBox(
-            width: 18,
-            child: CircleAvatar(
-              radius: 6,
-              backgroundColor: Colors.red,
-            ),
-          ),
-          scheduleItemWidget: const Text(
-            '杏聆荟每日站会',
-          ),
-        ),
-        _buildScheduleLayoutItem(
-          iconWidget: _buildIcon(
-            icon: Icons.av_timer_rounded,
-            size: 18,
-          ),
-          scheduleItemWidget: Text(
-            '${currentDate.month}月${currentDate.day}日 周 ${weekMap[currentDate.weekday]!} 10:00-10:30',
-          ),
-        ),
-        _buildScheduleLayoutItem(
-          iconWidget: _buildIcon(
-            icon: Icons.personal_injury_rounded,
-            size: 18,
-          ),
-          scheduleItemWidget: const Text('组织人'),
-        ),
-        _buildScheduleLayoutItem(
-          iconWidget: _buildIcon(
-            icon: Icons.people_alt_outlined,
-            size: 18,
-          ),
-          scheduleItemWidget: Row(
-            mainAxisSize: MainAxisSize.max,
-            children: const [
-              Text(
-                '邀请7人,5人接受',
+        Padding(
+          padding: const EdgeInsets.symmetric(horizontal: 8),
+          child: Column(
+            children: [
+              _buildScheduleHeadActionBar(),
+              _buildScheduleLayoutItem(
+                iconWidget: const SizedBox(
+                  width: 18,
+                  child: CircleAvatar(
+                    radius: 6,
+                    backgroundColor: Colors.red,
+                  ),
+                ),
+                scheduleItemWidget: const Text(
+                  '杏聆荟每日站会',
+                ),
+              ),
+              _buildScheduleLayoutItem(
+                iconWidget: _buildIcon(
+                  icon: Icons.av_timer_rounded,
+                  size: 18,
+                ),
+                scheduleItemWidget: Text(
+                  '${currentDate.month}月${currentDate.day}日 ${weekMap[currentDate.weekday]!} 10:00-10:30',
+                ),
               ),
-              Expanded(child: SizedBox()),
-              Text(
-                '查看全部',
-                style: TextStyle(
-                  fontSize: 12,
-                  color: Colors.grey,
+              _buildScheduleLayoutItem(
+                iconWidget: _buildIcon(
+                  icon: Icons.personal_injury_rounded,
+                  size: 18,
                 ),
+                scheduleItemWidget: const Text('组织人'),
+              ),
+              _buildScheduleLayoutItem(
+                iconWidget: _buildIcon(
+                  icon: Icons.people_alt_outlined,
+                  size: 18,
+                ),
+                scheduleItemWidget: Row(
+                  mainAxisSize: MainAxisSize.max,
+                  children: const [
+                    Text(
+                      '邀请7人,5人接受',
+                    ),
+                    Expanded(child: SizedBox()),
+                    Text(
+                      '查看全部',
+                      style: TextStyle(
+                        fontSize: 12,
+                        color: Colors.grey,
+                      ),
+                    ),
+                  ],
+                ),
+              ),
+              Row(
+                mainAxisAlignment: MainAxisAlignment.start,
+                children: [
+                  const SizedBox(
+                    width: 30,
+                  ),
+                  _buildHeadPortraitItem(),
+                  _buildHeadPortraitItem(),
+                  _buildHeadPortraitItem(),
+                  _buildHeadPortraitItem(),
+                  _buildHeadPortraitItem(),
+                ],
               ),
             ],
           ),
         ),
-        Row(
-          mainAxisAlignment: MainAxisAlignment.start,
-          children: [
-            const SizedBox(
-              width: 30,
-            ),
-            _buildHeadPortraitItem(),
-            _buildHeadPortraitItem(),
-            _buildHeadPortraitItem(),
-            _buildHeadPortraitItem(),
-            _buildHeadPortraitItem(),
-          ],
-        ),
         const SizedBox(
           height: 15,
         ),
-        const Divider(),
-        _buildSchedulebottomActionBar(),
+        Container(
+          decoration: const BoxDecoration(
+            border: Border(
+              top: BorderSide(
+                color: Color.fromRGBO(238, 238, 238, 1),
+                width: 1,
+              ),
+            ),
+          ),
+          padding: const EdgeInsets.symmetric(horizontal: 8),
+          child: _buildSchedulebottomActionBar(),
+        ),
       ],
     );
   }
@@ -166,7 +181,7 @@ class SchedulePopupState extends State<SchedulePopup> {
   /// 日程卡片顶部操作栏
   Widget _buildScheduleHeadActionBar() {
     return SizedBox(
-      height: 35,
+      height: 50,
       child: Row(
         mainAxisAlignment: MainAxisAlignment.end,
         children: [
@@ -194,14 +209,17 @@ class SchedulePopupState extends State<SchedulePopup> {
   /// 日程卡片底部操作栏
   Widget _buildSchedulebottomActionBar() {
     return SizedBox(
-      height: 35,
+      height: 50,
       child: Row(
         children: [
-          Container(
-            margin: const EdgeInsets.only(
-              left: 5,
+          SizedBox(
+            width: 10,
+          ),
+          const Text(
+            '查看详情',
+            style: TextStyle(
+              color: Colors.black54,
             ),
-            child: const Text('查看详情'),
           ),
           Expanded(
             child: Row(
@@ -259,7 +277,7 @@ class SchedulePopupState extends State<SchedulePopup> {
               borderRadius: BorderRadius.circular(
                 4,
               ),
-              color: Color.fromARGB(255, 41, 42, 54),
+              color: const Color.fromARGB(255, 41, 42, 54),
             ),
             child: const FlutterLogo(
               size: 28,

+ 3 - 1
lib/main.dart

@@ -37,7 +37,9 @@ class _MyHomePageState extends State<MyHomePage> {
   @override
   Widget build(BuildContext context) {
     return const Scaffold(
-      body: GlobalNotificationLayer(child: CalendarPage()),
+      body: GlobalNotificationLayer(
+        child: CalendarPage(),
+      ),
     );
   }
 }

+ 10 - 6
lib/popup_layer/popup_layer.dart

@@ -109,16 +109,19 @@ class _PopupLayerState extends State<PopupLayer> {
   Widget build(BuildContext context) {
     return Stack(
       children: [
-        if (_isShowMoreSchedulePopup)
-          Listener(
+        Offstage(
+          offstage: !_isShowMoreSchedulePopup,
+          child: Listener(
             behavior: HitTestBehavior.deferToChild,
             onPointerUp: (event) {
               _isNeedCloseMoreSchedulePopup = false;
             },
             child: _buildMoreSchedulePopup(moreSchedulePopupKey),
           ),
-        if (_isShowScheduleDetailPopup)
-          Listener(
+        ),
+        Offstage(
+          offstage: !_isShowScheduleDetailPopup,
+          child: Listener(
             behavior: HitTestBehavior.deferToChild,
             onPointerUp: (event) {
               setState(() {
@@ -126,7 +129,8 @@ class _PopupLayerState extends State<PopupLayer> {
               });
             },
             child: _buildScheduleDetailPopup(scheduleDetailPopupKey),
-          )
+          ),
+        ),
       ],
     );
   }
@@ -264,7 +268,7 @@ class ScheduleAutoAlignFlowDelegate extends FlowDelegate {
   }
 
   @override
-  bool shouldRepaint(FlowDelegate oldDelegate) {
+  bool shouldRepaint(ScheduleAutoAlignFlowDelegate oldDelegate) {
     return oldDelegate != this;
   }
 }