forked from toly1994328/FlutterUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesk_widget_top_bar.dart
More file actions
74 lines (62 loc) · 2.32 KB
/
desk_widget_top_bar.dart
File metadata and controls
74 lines (62 loc) · 2.32 KB
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
import 'package:components/toly_ui/toly_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_unit/app/plateform_adapter/window/windows_adapter.dart';
import '../widget_ui/desk_ui/widget_panel/window_buttons.dart';
class DeskCodeGenTopBar extends StatefulWidget {
final ValueChanged<int> onTabPressed;
final VoidCallback onTapGen;
const DeskCodeGenTopBar({Key? key,required this.onTabPressed, required this.onTapGen}) : super(key: key);
@override
State<DeskCodeGenTopBar> createState() => _DeskCodeGenTopBarState();
}
class _DeskCodeGenTopBarState extends State<DeskCodeGenTopBar> with SingleTickerProviderStateMixin {
late TabController tabController;
static const List<String> _tabs = ['IconFont', '数据类' , '状态管理', 'Json 解析',];
@override
void initState() {
super.initState();
tabController = TabController(length: _tabs.length, vsync: this);
}
@override
Widget build(BuildContext context) {
Color themeColor = Theme.of(context).primaryColor;
bool isDark = Theme.of(context).brightness == Brightness.dark;
return DragToMoveAreaNoDouble(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
height: 64,
color: isDark?Color(0xff2C3036):Colors.white,
child: Row(
children: [
SizedBox(
width: 350,
child: TabBar(
onTap: widget.onTabPressed,
indicatorSize: TabBarIndicatorSize.label,
labelPadding: const EdgeInsets.symmetric(horizontal: 6),
isScrollable: false,
indicator: RoundRectTabIndicator(
borderSide: BorderSide(color: themeColor, width: 3),
),
labelStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
controller: tabController,
labelColor: themeColor,
indicatorWeight: 3,
unselectedLabelColor: Colors.grey,
indicatorColor: themeColor,
tabs:
_tabs.map((String name) => Tab(text: name)).toList(),
),
),
Spacer(),
const SizedBox(width: 20,),
WindowButtons(),
],
),
),
);
}
}