#
whycq
2025-03-03 6a90c5bde0facc8330ce4c7c7d89292717b7ac65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:zy_wms_pda/pages/toolbar/device/device_page.dart';
import 'package:zy_wms_pda/pages/toolbar/home/home_page.dart';
import 'package:zy_wms_pda/pages/toolbar/menu/menu_page.dart';
import 'package:zy_wms_pda/pages/toolbar/quick/quick_page.dart';
 
import '../../common/user_icon_button.dart';
import 'line_chart.dart';
 
class Toolbar extends StatefulWidget {
  const Toolbar({super.key});
 
  @override
  State<StatefulWidget> createState() => _ToolbarState();
}
 
class _ToolbarState extends State<Toolbar> {
  int cuttentIndex = 0;
 
  PageController _pageController = PageController();
 
  final List<String> _titles = [
    '首页',
    '菜单',
    '设备管理',
    '快捷中心',
  ];
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(_titles[cuttentIndex]),
        leading:Builder(
          builder: (BuildContext context) {
            return UserIconButton();
          },
        ),
      ),
      drawer: Drawer(
        elevation: 20,
        width: 1100.w,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(0.0),
        ),
        child: ListView(
          padding: EdgeInsets.zero,
          children: <Widget>[
            DrawerHeader(
              decoration: BoxDecoration(color: Color.fromRGBO(95, 185, 97, 1)),
              child: Container(
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(20)
                ),
                padding: EdgeInsets.all(5),
                margin: EdgeInsets.only(bottom: 10),
                child: Text('data'),
              ),
            ),
            ListTile(
              leading: Icon(Icons.home),
              title: Text('首页'),
              onTap: () {
                // 处理点击事件
                Navigator.pop(context); // 关闭侧边栏
              },
            ),
            ListTile(
              leading: Icon(Icons.settings),
              title: Text('设置'),
              onTap: () {
                // 处理点击事件
                Navigator.pop(context); // 关闭侧边栏
              },
            ),
            ListTile(
              leading: Icon(Icons.info),
              title: Text('关于'),
              onTap: () {
                // 处理点击事件
                Navigator.pop(context); // 关闭侧边栏
                Get.offAllNamed("/");
              },
            ),
          ],
        ),
      ),
      body: PageView(
        controller: _pageController,
        physics: NeverScrollableScrollPhysics(),
        children: [
          HomePage(),
          MenuPage(),
          DevicePage(),
          QuickPage(),
          // LineChartSample2()
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        selectedItemColor: Color.fromRGBO(43, 76, 126, 1),
        unselectedItemColor: Color.fromRGBO(43, 76, 126, .5),
        currentIndex: cuttentIndex,
        type: BottomNavigationBarType.fixed,
        onTap: (index) {
          setState(() {
            _pageController.jumpToPage(index);
            cuttentIndex = index;
          });
        },
        items: [
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: '首页',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.menu_book_rounded),
            label: '菜单',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.memory),
            label: '设备',
          ),
          BottomNavigationBarItem(
            icon: Icon(
              Icons.quickreply,
            ),
            label: '快捷',
          ),
          // BottomNavigationBarItem(
          //   icon: Icon(
          //     Icons.quickreply,
          //   ),
          //   label: '11',
          // ),
        ],
      ),
    );
  }
}