123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- 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<CalendarLeftPanel> createState() => _CalendarLeftPanelState();
- }
- class _CalendarLeftPanelState extends State<CalendarLeftPanel> {
- @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: <Widget>[
- _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: <Widget>[
- /// 单行输入框
- 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<EdgeInsetsGeometry>(
- const EdgeInsets.all(0)),
- shadowColor:
- MaterialStateProperty.all<Color>(Colors.transparent),
- ),
- onPressed: (() {
- ///FIXME: 临时测试用
- NotificationController notificationController =
- Get.find<NotificationController>();
- 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<Color>(Colors.transparent),
- shadowColor:
- MaterialStateProperty.all<Color>(Colors.transparent),
- overlayColor: MaterialStateProperty.all<Color>(
- const Color.fromARGB(255, 224, 226, 228)),
- foregroundColor:
- MaterialStateProperty.all<Color>(Colors.white),
- surfaceTintColor:
- MaterialStateProperty.all<Color>(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
- }
|