2022-08-11 16:03:04 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_hbb/common.dart';
|
|
|
|
import 'package:flutter_hbb/consts.dart';
|
|
|
|
import 'package:flutter_hbb/desktop/pages/desktop_home_page.dart';
|
|
|
|
import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart';
|
|
|
|
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
2022-08-26 23:28:08 +08:00
|
|
|
import 'package:get/get.dart';
|
2022-08-22 13:51:05 +08:00
|
|
|
import 'package:window_manager/window_manager.dart';
|
2022-08-11 16:03:04 +08:00
|
|
|
|
|
|
|
class DesktopTabPage extends StatefulWidget {
|
|
|
|
const DesktopTabPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<DesktopTabPage> createState() => _DesktopTabPageState();
|
|
|
|
}
|
|
|
|
|
2022-08-18 10:54:09 +08:00
|
|
|
class _DesktopTabPageState extends State<DesktopTabPage> {
|
2022-09-01 21:18:53 +08:00
|
|
|
final tabController = DesktopTabController(tabType: DesktopTabType.main);
|
2022-08-11 16:03:04 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
2022-08-26 12:14:14 +08:00
|
|
|
tabController.add(TabInfo(
|
2022-08-24 20:12:04 +08:00
|
|
|
key: kTabLabelHomePage,
|
|
|
|
label: kTabLabelHomePage,
|
|
|
|
selectedIcon: Icons.home_sharp,
|
|
|
|
unselectedIcon: Icons.home_outlined,
|
|
|
|
closable: false,
|
2022-08-26 12:14:14 +08:00
|
|
|
page: DesktopHomePage(
|
|
|
|
key: const ValueKey(kTabLabelHomePage),
|
|
|
|
)));
|
2022-08-11 16:03:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-08-26 23:28:08 +08:00
|
|
|
RxBool fullscreen = false.obs;
|
|
|
|
Get.put(fullscreen, tag: 'fullscreen');
|
|
|
|
return Obx(() => DragToResizeArea(
|
2022-09-03 18:19:50 +08:00
|
|
|
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(color: MyTheme.color(context).border!)),
|
|
|
|
child: Overlay(initialEntries: [
|
|
|
|
OverlayEntry(builder: (context) {
|
|
|
|
gFFI.dialogManager.setOverlayState(Overlay.of(context));
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyTheme.color(context).bg,
|
|
|
|
body: DesktopTab(
|
|
|
|
controller: tabController,
|
|
|
|
tail: ActionIcon(
|
|
|
|
message: 'Settings',
|
|
|
|
icon: IconFont.menu,
|
|
|
|
onTap: onAddSetting,
|
2022-09-04 11:03:16 +08:00
|
|
|
isClose: false,
|
2022-09-03 18:19:50 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
})
|
|
|
|
]),
|
|
|
|
)));
|
2022-08-11 16:03:04 +08:00
|
|
|
}
|
|
|
|
|
2022-08-11 18:08:35 +08:00
|
|
|
void onAddSetting() {
|
2022-08-24 20:17:51 +08:00
|
|
|
tabController.add(TabInfo(
|
2022-08-24 20:12:04 +08:00
|
|
|
key: kTabLabelSettingPage,
|
|
|
|
label: kTabLabelSettingPage,
|
|
|
|
selectedIcon: Icons.build_sharp,
|
|
|
|
unselectedIcon: Icons.build_outlined,
|
2022-08-26 12:14:14 +08:00
|
|
|
page: DesktopSettingPage(key: const ValueKey(kTabLabelSettingPage))));
|
2022-08-11 16:03:04 +08:00
|
|
|
}
|
|
|
|
}
|