import 'package:calendar_view/calendar_page/mini_calendar/mini_calendar.dart'; import 'package:calendar_view/calendar_page/my_calendar/my_calendar.dart'; import 'package:calendar_view/notification_demo/notification_controller.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; /// 日历视图左侧面板 class CalendarLeftPanel extends StatefulWidget { const CalendarLeftPanel({super.key}); @override State createState() => _CalendarLeftPanelState(); } class _CalendarLeftPanelState extends State { @override Widget build(BuildContext context) { return Container( width: 240, decoration: const BoxDecoration( border: Border( right: BorderSide( color: Colors.black12, width: 1, ), ), // color: const Color.fromARGB(90, 59, 255, 124), ), padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ _buildPanelTop(), const MiniCalendar(), const Expanded( child: MyCalendar(), ), // 撑开 _buildPanelBottom(), ], ), ); } /// 构建顶部【搜索日程、添加日程】 Widget _buildPanelTop() { return SizedBox( height: 70, child: Container( padding: const EdgeInsets.symmetric(horizontal: 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ /// 单行输入框 const Expanded( child: SizedBox( height: 32, child: TextField( textAlignVertical: TextAlignVertical.bottom, style: TextStyle( height: null, // 迷惑??? color: Colors.black, fontSize: 14, ), decoration: InputDecoration( // contentPadding: EdgeInsets.all(12), // 迷惑??? border: OutlineInputBorder(), enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.black12, width: 1), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.blue, width: 1), ), prefixIcon: Icon( Icons.search, size: 20, color: Colors.black38, ), /// TODO[Gavin]: i18n hintText: '搜索日程', hintStyle: TextStyle( color: Colors.black38, fontSize: 14, ), ), ), ), ), const SizedBox(width: 10), SizedBox( width: 32, height: 32, child: ElevatedButton( style: ButtonStyle( padding: MaterialStateProperty.all( const EdgeInsets.all(0)), shadowColor: MaterialStateProperty.all(Colors.transparent), ), onPressed: (() { ///FIXME: 临时测试用 NotificationController notificationController = Get.find(); notificationController.sendMockNotification(); }), child: const Icon(Icons.add), ), ), ], ), ), ); } /// 构建底部【日历设置】 Widget _buildPanelBottom() { return Container( padding: const EdgeInsets.symmetric(vertical: 5), height: 50, decoration: const BoxDecoration( border: Border( top: BorderSide( color: Colors.black12, width: 1, ), ), // color: const Color.fromARGB(90, 222, 59, 255), ), child: Flex( direction: Axis.horizontal, children: [ Expanded( child: SizedBox( height: double.infinity, child: ElevatedButton.icon( style: ButtonStyle( // 按钮内容左对齐 alignment: Alignment.centerLeft, backgroundColor: MaterialStateProperty.all(Colors.transparent), shadowColor: MaterialStateProperty.all(Colors.transparent), overlayColor: MaterialStateProperty.all( const Color.fromARGB(255, 224, 226, 228)), foregroundColor: MaterialStateProperty.all(Colors.white), surfaceTintColor: MaterialStateProperty.all(Colors.white), ), icon: const Icon( Icons.settings_outlined, size: 20, color: Colors.black54, ), /// TODO[Gavin]: i18n label: const Text( "日历设置", style: TextStyle(color: Colors.black87), ), onPressed: () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( duration: Duration(milliseconds: 500), content: Text('前方正在施工'), ), ); }, ), ), ), ], ), ); } // Widget _build }