From 47f82097e25a1adabefdd07deb8784ed3bbc7c83 Mon Sep 17 00:00:00 2001 From: YuanHuakk <1751826683@qq.com> Date: Thu, 4 Jan 2024 16:41:51 +0800 Subject: [PATCH] git --- .../data_count/data_count_logic.dart | 46 ++ .../data_count/data_count_state.dart | 5 + .../data_count/data_count_view.dart | 40 ++ .../home/components/data_count/index.dart | 5 + .../home/components/header/header_logic.dart | 19 + .../home/components/header/header_state.dart | 5 + .../home/components/header/header_view.dart | 59 +++ .../layout/home/components/header/index.dart | 5 + .../layout/home/components/menu/index.dart | 5 + .../home/components/menu/menu_logic.dart | 64 +++ .../home/components/menu/menu_state.dart | 5 + .../home/components/menu/menu_view.dart | 66 +++ .../home/components/order_card/index.dart | 5 + .../order_card/order_card_logic.dart | 53 +++ .../order_card/order_card_state.dart | 5 + .../order_card/order_card_view.dart | 58 +++ lib/pages/layout/home/home_logic.dart | 50 -- lib/pages/layout/home/home_view copy.dart | 441 ------------------ lib/pages/layout/home/home_view.dart | 132 +----- lib/pages/splash/splash_logic.dart | 2 +- lib/pages/tab/tab_view.dart | 54 +-- lib/router/app_pages.dart | 4 +- 22 files changed, 483 insertions(+), 645 deletions(-) create mode 100644 lib/pages/layout/home/components/data_count/data_count_logic.dart create mode 100644 lib/pages/layout/home/components/data_count/data_count_state.dart create mode 100644 lib/pages/layout/home/components/data_count/data_count_view.dart create mode 100644 lib/pages/layout/home/components/data_count/index.dart create mode 100644 lib/pages/layout/home/components/header/header_logic.dart create mode 100644 lib/pages/layout/home/components/header/header_state.dart create mode 100644 lib/pages/layout/home/components/header/header_view.dart create mode 100644 lib/pages/layout/home/components/header/index.dart create mode 100644 lib/pages/layout/home/components/menu/index.dart create mode 100644 lib/pages/layout/home/components/menu/menu_logic.dart create mode 100644 lib/pages/layout/home/components/menu/menu_state.dart create mode 100644 lib/pages/layout/home/components/menu/menu_view.dart create mode 100644 lib/pages/layout/home/components/order_card/index.dart create mode 100644 lib/pages/layout/home/components/order_card/order_card_logic.dart create mode 100644 lib/pages/layout/home/components/order_card/order_card_state.dart create mode 100644 lib/pages/layout/home/components/order_card/order_card_view.dart delete mode 100644 lib/pages/layout/home/home_view copy.dart diff --git a/lib/pages/layout/home/components/data_count/data_count_logic.dart b/lib/pages/layout/home/components/data_count/data_count_logic.dart new file mode 100644 index 0000000..71671d0 --- /dev/null +++ b/lib/pages/layout/home/components/data_count/data_count_logic.dart @@ -0,0 +1,46 @@ +import 'package:get/get.dart'; + +import 'data_count_state.dart'; + +class DataCountLogic extends GetxController { + final DataCountState state = DataCountState(); + + final List> list = [ + { + "title": "今日成交额", + "value": "100000", + }, + { + "title": "昨日成交额", + "value": "2000", + }, + { + "title": "本月成交额", + "value": "10000", + }, + { + "title": "今日订单数", + "value": "100", + }, + { + "title": "昨日订单数", + "value": "200", + }, + { + "title": "本月订单数", + "value": "5000", + }, + ]; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } +} diff --git a/lib/pages/layout/home/components/data_count/data_count_state.dart b/lib/pages/layout/home/components/data_count/data_count_state.dart new file mode 100644 index 0000000..04ee1c6 --- /dev/null +++ b/lib/pages/layout/home/components/data_count/data_count_state.dart @@ -0,0 +1,5 @@ +class DataCountState { + DataCountState() { + ///Initialize variables + } +} diff --git a/lib/pages/layout/home/components/data_count/data_count_view.dart b/lib/pages/layout/home/components/data_count/data_count_view.dart new file mode 100644 index 0000000..7448522 --- /dev/null +++ b/lib/pages/layout/home/components/data_count/data_count_view.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import 'data_count_logic.dart'; + +class DataCountComponent extends StatelessWidget { + const DataCountComponent({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final logic = Get.put(DataCountLogic()); + final state = Get.find().state; + + return Wrap( + direction: Axis.horizontal, + spacing: 55, + runSpacing: 15, + alignment: WrapAlignment.center, + children: logic.list.map((item) { + return Column( + children: [ + Text( + item["title"]!, + style: const TextStyle( + color: Colors.grey, + fontSize: 16, + ), + ), + Text( + item["value"]!, + style: const TextStyle( + color: Colors.black, + fontSize: 19, + fontWeight: FontWeight.bold), + ), + ], + ); + }).toList()); + } +} diff --git a/lib/pages/layout/home/components/data_count/index.dart b/lib/pages/layout/home/components/data_count/index.dart new file mode 100644 index 0000000..d43eac0 --- /dev/null +++ b/lib/pages/layout/home/components/data_count/index.dart @@ -0,0 +1,5 @@ +library data_count_component; + +export './data_count_logic.dart'; +export './data_count_state.dart'; +export './data_count_view.dart'; \ No newline at end of file diff --git a/lib/pages/layout/home/components/header/header_logic.dart b/lib/pages/layout/home/components/header/header_logic.dart new file mode 100644 index 0000000..b0c7a52 --- /dev/null +++ b/lib/pages/layout/home/components/header/header_logic.dart @@ -0,0 +1,19 @@ +import 'package:get/get.dart'; + +import 'header_state.dart'; + +class HeaderLogic extends GetxController { + final HeaderState state = HeaderState(); + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } +} diff --git a/lib/pages/layout/home/components/header/header_state.dart b/lib/pages/layout/home/components/header/header_state.dart new file mode 100644 index 0000000..0268452 --- /dev/null +++ b/lib/pages/layout/home/components/header/header_state.dart @@ -0,0 +1,5 @@ +class HeaderState { + HeaderState() { + ///Initialize variables + } +} diff --git a/lib/pages/layout/home/components/header/header_view.dart b/lib/pages/layout/home/components/header/header_view.dart new file mode 100644 index 0000000..ef2f0bd --- /dev/null +++ b/lib/pages/layout/home/components/header/header_view.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../../../../utils/utils.dart'; +import 'header_logic.dart'; + +class HeaderComponent extends StatelessWidget { + const HeaderComponent({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final logic = Get.put(HeaderLogic()); + final state = Get.find().state; + + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(50), + child: Image.network( + "https://pic.ziyuan.wang/user/guest/2023/12/微信图片_20231109211458_c1a41ab0fd7dd.jpg", + width: 50.0, + )), + const SizedBox( + width: 5, + ), + const Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "商家: GAGA酒吧", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500), + ), + Text( + "Huakk,欢迎回来!!!", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400), + ) + ], + ) + ], + ), + Row( + children: [ + IconButton( + onPressed: () { + ToolFn.tips("点击了核销按钮"); + }, + icon: const Icon( + Icons.qr_code_scanner, + size: 32, + )) + ], + ) + ], + ); + } +} diff --git a/lib/pages/layout/home/components/header/index.dart b/lib/pages/layout/home/components/header/index.dart new file mode 100644 index 0000000..9796c5e --- /dev/null +++ b/lib/pages/layout/home/components/header/index.dart @@ -0,0 +1,5 @@ +library header_component; + +export './header_logic.dart'; +export './header_state.dart'; +export './header_view.dart'; \ No newline at end of file diff --git a/lib/pages/layout/home/components/menu/index.dart b/lib/pages/layout/home/components/menu/index.dart new file mode 100644 index 0000000..540958d --- /dev/null +++ b/lib/pages/layout/home/components/menu/index.dart @@ -0,0 +1,5 @@ +library menu_component; + +export './menu_view.dart'; +export './menu_state.dart'; +export './menu_logic.dart'; diff --git a/lib/pages/layout/home/components/menu/menu_logic.dart b/lib/pages/layout/home/components/menu/menu_logic.dart new file mode 100644 index 0000000..4ebdd9d --- /dev/null +++ b/lib/pages/layout/home/components/menu/menu_logic.dart @@ -0,0 +1,64 @@ +import 'package:get/get.dart'; + +import 'menu_state.dart'; + +class MenuLogic extends GetxController { + final MenuState state = MenuState(); + + final List menuList = [ + { + "icon": "https://pic.ziyuan.wang/user/guest/2023/12/ 1_fac68ecc764a6.png", + "title": "商品管理", + "page": "/good", + }, + { + "icon": "https://pic.ziyuan.wang/user/guest/2023/12/ 1_fac68ecc764a6.png", + "title": "订单管理", + "page": "/order", + }, + { + "icon": "https://pic.ziyuan.wang/user/guest/2023/12/ 1_fac68ecc764a6.png", + "title": "店铺设置", + "page": "/settings" + }, + { + "icon": "https://pic.ziyuan.wang/user/guest/2023/12/ 1_fac68ecc764a6.png", + "title": "发布商品", + "page": "/addGood" + }, + { + "icon": "https://pic.ziyuan.wang/user/guest/2023/12/ 1_fac68ecc764a6.png", + "title": "数据统计", + "page": "/data" + }, + { + "icon": + "https://pic.ziyuan.wang/user/guest/2023/12/%201%20_1__eb4ee5cc67484.png", + "title": "提现管理", + "page": "/cash" + }, + { + "icon": + "https://pic.ziyuan.wang/user/guest/2023/12/%201%20_1__eb4ee5cc67484.png", + "title": "员工管理", + "page": "/perm" + } + ]; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } + + // 跳转页面 + void goPage(String page) { + Get.toNamed(page); + } +} diff --git a/lib/pages/layout/home/components/menu/menu_state.dart b/lib/pages/layout/home/components/menu/menu_state.dart new file mode 100644 index 0000000..3e7cfca --- /dev/null +++ b/lib/pages/layout/home/components/menu/menu_state.dart @@ -0,0 +1,5 @@ +class MenuState { + MenuState() { + ///Initialize variables + } +} diff --git a/lib/pages/layout/home/components/menu/menu_view.dart b/lib/pages/layout/home/components/menu/menu_view.dart new file mode 100644 index 0000000..a90253e --- /dev/null +++ b/lib/pages/layout/home/components/menu/menu_view.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import 'menu_logic.dart'; + +class MenuComponent extends StatelessWidget { + const MenuComponent({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final logic = Get.put(MenuLogic()); + final state = Get.find().state; + + // return SizedBox( + // width: double.infinity, + // child: Wrap( + // direction: Axis.horizontal, + // alignment: WrapAlignment.spaceBetween, + // spacing: 15, + // runSpacing: 10, + // children: logic.menuList.map((item) { + // return GestureDetector( + // onTap: () { + // logic.goPage(item["page"]); + // }, + // child: Column( + // children: [ + // Image( + // image: NetworkImage(item["icon"]), + // width: 65, + // ), + // Text(item["title"], + // style: const TextStyle(fontWeight: FontWeight.w500)) + // ], + // ), + // ); + // }).toList(), + // ), + // ); + + return SizedBox( + height: 175.h, + child: GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 5, childAspectRatio: 0.8), + children: logic.menuList.map((item) { + return GestureDetector( + onTap: () { + logic.goPage(item["page"]); + }, + child: Column( + children: [ + Image( + image: NetworkImage(item["icon"]), + width: 65.w, + ), + Text(item["title"], + style: const TextStyle(fontWeight: FontWeight.w500)) + ], + ), + ); + }).toList()), + ); + } +} diff --git a/lib/pages/layout/home/components/order_card/index.dart b/lib/pages/layout/home/components/order_card/index.dart new file mode 100644 index 0000000..895e7b2 --- /dev/null +++ b/lib/pages/layout/home/components/order_card/index.dart @@ -0,0 +1,5 @@ +library order_card_component; + +export './order_card_logic.dart'; +export './order_card_state.dart'; +export './order_card_view.dart'; diff --git a/lib/pages/layout/home/components/order_card/order_card_logic.dart b/lib/pages/layout/home/components/order_card/order_card_logic.dart new file mode 100644 index 0000000..c68a791 --- /dev/null +++ b/lib/pages/layout/home/components/order_card/order_card_logic.dart @@ -0,0 +1,53 @@ +import 'package:get/get.dart'; + +import 'order_card_state.dart'; + +class OrderCardLogic extends GetxController { + final OrderCardState state = OrderCardState(); + + final List> list = [ + { + "id": "0", + "title": "全部", + "value": "2000", + }, + { + "id": "1", + "title": "待付款", + "value": "10", + }, + { + "id": "2", + "title": "待核销", + "value": "200", + }, + { + "id": "3", + "title": "已核销", + "value": "2000", + }, + { + "id": "4", + "title": "已过期", + "value": "100", + }, + ]; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } + + void toPage(String index) { + Get.toNamed('/order_list', arguments: { + "type": index, + }); + } +} diff --git a/lib/pages/layout/home/components/order_card/order_card_state.dart b/lib/pages/layout/home/components/order_card/order_card_state.dart new file mode 100644 index 0000000..2ac24ee --- /dev/null +++ b/lib/pages/layout/home/components/order_card/order_card_state.dart @@ -0,0 +1,5 @@ +class OrderCardState { + OrderCardState() { + ///Initialize variables + } +} diff --git a/lib/pages/layout/home/components/order_card/order_card_view.dart b/lib/pages/layout/home/components/order_card/order_card_view.dart new file mode 100644 index 0000000..f54fcd8 --- /dev/null +++ b/lib/pages/layout/home/components/order_card/order_card_view.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'order_card_logic.dart'; + +class OrderCardComponent extends StatelessWidget { + const OrderCardComponent({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final logic = Get.put(OrderCardLogic()); + final state = Get.find().state; + + return Container( + constraints: const BoxConstraints.tightFor( + width: double.maxFinite, + ), + decoration: BoxDecoration( + color: Colors.blueAccent, + borderRadius: BorderRadius.circular(15), + ), + child: Wrap( + direction: Axis.horizontal, + spacing: 25, + runSpacing: 10, + alignment: WrapAlignment.center, + children: logic.list.map((item) { + return GestureDetector( + onTap: () { + // ToolFn.tips("点击了${item["title"]}"); + logic.toPage(item["id"].toString()); + }, + child: SizedBox( + height: 90, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + item["value"]!, + style: const TextStyle( + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.bold), + ), + Text( + item["title"]!, + style: const TextStyle( + color: Colors.white, + fontSize: 15, + ), + ), + ], + ), + ), + ); + }).toList()), + ); + } +} diff --git a/lib/pages/layout/home/home_logic.dart b/lib/pages/layout/home/home_logic.dart index c0a2f01..10c1b7f 100644 --- a/lib/pages/layout/home/home_logic.dart +++ b/lib/pages/layout/home/home_logic.dart @@ -5,56 +5,6 @@ import 'home_state.dart'; class HomeLogic extends GetxController { final HomeState state = HomeState(); - final List> list = [ - { - "title": "今日成交额", - "value": "100000", - }, - { - "title": "昨日成交额", - "value": "2000", - }, - { - "title": "本月成交额", - "value": "10000", - }, - { - "title": "今日订单数", - "value": "100", - }, - { - "title": "昨日订单数", - "value": "200", - }, - { - "title": "本月订单数", - "value": "5000", - }, - ]; - - final List> list2 = [ - { - "title": "全部", - "value": "2000", - }, - { - "title": "待付款", - "value": "10", - }, - { - "title": "待核销", - "value": "200", - }, - { - "title": "已核销", - "value": "2000", - }, - { - "title": "已过期", - "value": "100", - }, - ]; - @override void onReady() { // TODO: implement onReady diff --git a/lib/pages/layout/home/home_view copy.dart b/lib/pages/layout/home/home_view copy.dart deleted file mode 100644 index a61e5be..0000000 --- a/lib/pages/layout/home/home_view copy.dart +++ /dev/null @@ -1,441 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:tdesign_flutter/tdesign_flutter.dart'; - -import '../../../utils/utils.dart'; -import 'home_logic.dart'; - -class HomePage extends StatelessWidget { - const HomePage({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - final logic = Get.find(); - final state = Get.find().state; - - double statusBarHeight = MediaQuery.of(context).padding.top; - - return PopScope( - canPop: false, - onPopInvoked: (_) { - ToolFn().isExit(); - }, - child: Scaffold( - body: Stack( - fit: StackFit.expand, - children: [ - Image.asset( - 'assets/images/home-tab-normal-bg.png', - fit: BoxFit.fitWidth, - ), - Padding( - padding: - EdgeInsets.only(top: statusBarHeight, left: 10, right: 10), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(50), - child: Image.network( - "https://pic.ziyuan.wang/user/guest/2023/12/微信图片_20231109211458_c1a41ab0fd7dd.jpg", - width: 50.0, - )), - const SizedBox( - width: 5, - ), - const Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "商家: GAGA酒吧", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500), - ), - Text( - "Huakk,欢迎回来!!!", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400), - ) - ], - ) - ], - ), - Row( - children: [ - GestureDetector( - onTap: () { - ToolFn.tips("点击了核销按钮"); - }, - child: const Icon( - Icons.qr_code_scanner, - size: 32, - ), - ), - ], - ) - ], - ), - const SizedBox( - height: 20, - ), - Wrap( - direction: Axis.horizontal, - spacing: 70, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list.map((item) { - return Column( - children: [ - Text( - item["title"]!, - style: const TextStyle( - color: Colors.grey, - fontSize: 15, - ), - ), - Text( - item["value"]!, - style: const TextStyle( - color: Colors.black, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - ], - ); - }).toList()), - // const SizedBox( - // height: 10, - // ), - ListView(shrinkWrap: true, children: [ - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( - height: 10, - ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( - height: 10, - ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( - height: 10, - ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( - height: 10, - ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( - height: 10, - ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( - height: 10, - ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - ]), - ], - )) - ], - ))); - } -} diff --git a/lib/pages/layout/home/home_view.dart b/lib/pages/layout/home/home_view.dart index 6f4c313..c5ef554 100644 --- a/lib/pages/layout/home/home_view.dart +++ b/lib/pages/layout/home/home_view.dart @@ -3,6 +3,10 @@ import 'package:get/get.dart'; import 'package:tdesign_flutter/tdesign_flutter.dart'; import '../../../utils/utils.dart'; +import 'components/data_count/index.dart'; +import 'components/header/header_view.dart'; +import 'components/menu/index.dart'; +import 'components/order_card/index.dart'; import 'home_logic.dart'; class HomePage extends StatelessWidget { @@ -20,6 +24,7 @@ class HomePage extends StatelessWidget { }, child: Scaffold( body: Container( + width: double.maxFinite, padding: const EdgeInsets.only(top: 0, left: 10, right: 10), decoration: const BoxDecoration( image: DecorationImage( @@ -29,128 +34,19 @@ class HomePage extends StatelessWidget { ), child: ListView( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(50), - child: Image.network( - "https://pic.ziyuan.wang/user/guest/2023/12/微信图片_20231109211458_c1a41ab0fd7dd.jpg", - width: 50.0, - )), - const SizedBox( - width: 5, - ), - const Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "商家: GAGA酒吧", - style: TextStyle( - fontSize: 16, fontWeight: FontWeight.w500), - ), - Text( - "Huakk,欢迎回来!!!", - style: TextStyle( - fontSize: 16, fontWeight: FontWeight.w400), - ) - ], - ) - ], - ), - Row( - children: [ - IconButton( - onPressed: () { - ToolFn.tips("点击了核销按钮"); - }, - icon: const Icon( - Icons.qr_code_scanner, - size: 32, - )) - ], - ) - ], - ), - const SizedBox( - height: 20, - ), - Wrap( - direction: Axis.horizontal, - spacing: 70, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list.map((item) { - return Column( - children: [ - Text( - item["title"]!, - style: const TextStyle( - color: Colors.grey, - fontSize: 15, - ), - ), - Text( - item["value"]!, - style: const TextStyle( - color: Colors.black, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - ], - ); - }).toList()), - const SizedBox( + HeaderComponent(), + SizedBox( height: 10, ), - Container( - constraints: const BoxConstraints.tightFor( - width: double.maxFinite, - ), - decoration: BoxDecoration( - color: Colors.blueAccent, - borderRadius: BorderRadius.circular(15), - ), - child: Wrap( - direction: Axis.horizontal, - spacing: 25, - runSpacing: 10, - alignment: WrapAlignment.center, - children: logic.list2.map((item) { - return GestureDetector( - onTap: () { - ToolFn.tips("点击了${item["title"]}"); - }, - child: SizedBox( - height: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item["value"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.bold), - ), - Text( - item["title"]!, - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - ), - ], - ), - ), - ); - }).toList()), - ), - const SizedBox( + DataCountComponent(), + SizedBox( height: 10, ), + OrderCardComponent(), + SizedBox( + height: 10, + ), + MenuComponent(), ], ), ))); diff --git a/lib/pages/splash/splash_logic.dart b/lib/pages/splash/splash_logic.dart index db0c0b6..6596f57 100644 --- a/lib/pages/splash/splash_logic.dart +++ b/lib/pages/splash/splash_logic.dart @@ -37,7 +37,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin { void initAnimation() { animationController = AnimationController( vsync: this, - duration: const Duration(seconds: 1), + duration: const Duration(milliseconds: 500), ); animation = Tween( diff --git a/lib/pages/tab/tab_view.dart b/lib/pages/tab/tab_view.dart index 7a243ae..482f3f2 100644 --- a/lib/pages/tab/tab_view.dart +++ b/lib/pages/tab/tab_view.dart @@ -1,3 +1,6 @@ +import 'dart:io'; +import 'dart:ui'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -28,47 +31,32 @@ class TabPage extends StatelessWidget { ); } - List createBottomItems() { - return [ - const BottomNavigationBarItem( - icon: Icon( - TDIcons.dashboard, - color: Colors.grey, - ), - activeIcon: Icon( - TDIcons.dashboard, - color: Color.fromRGBO(0, 82, 217, 1), - ), - label: "工作台", + List createBottomItems() { + return [ + const NavigationDestination( + selectedIcon: Icon(TDIcons.dashboard, color: Colors.white), + icon: Icon(TDIcons.dashboard), + label: '工作台', ), - const BottomNavigationBarItem( - icon: Icon( - TDIcons.desktop, - color: Colors.grey, - ), - activeIcon: Icon( - TDIcons.desktop, - color: Color.fromRGBO(0, 82, 217, 1), - ), - label: "商家中心", + const NavigationDestination( + selectedIcon: Icon(TDIcons.desktop, color: Colors.white), + icon: Icon(TDIcons.desktop), + label: '商家中心', ), ]; } /// 底部导航 Widget buildBottomNavigationBar() { - List bottomItems = createBottomItems(); - return BottomNavigationBar( - items: bottomItems, - currentIndex: state.currentPage, + List bottomItems = createBottomItems(); + return NavigationBar( backgroundColor: Colors.white, - unselectedItemColor: Colors.grey, - selectedItemColor: const Color.fromRGBO(0, 82, 217, 1), - type: BottomNavigationBarType.fixed, - onTap: logic.handleNavBarTap, - selectedFontSize: 10.sp, - unselectedFontSize: 10.sp, - iconSize: 32.w, + shadowColor: Colors.black, + surfaceTintColor: Colors.white, + indicatorColor: Colors.blueAccent, + onDestinationSelected: logic.handleNavBarTap, + selectedIndex: state.currentPage, + destinations: bottomItems, ); } diff --git a/lib/router/app_pages.dart b/lib/router/app_pages.dart index 7b4d25b..2d7a4b1 100644 --- a/lib/router/app_pages.dart +++ b/lib/router/app_pages.dart @@ -18,6 +18,8 @@ class AppPages { binding: SplashBinding()), GetPage( name: AppPages.login, page: () => LoginPage(), binding: LoginBinding()), + GetPage( + name: AppPages.tab, page: () => const TabPage(), binding: TabBinding()), GetPage( name: AppPages.home, page: () => const HomePage(), @@ -26,7 +28,5 @@ class AppPages { name: AppPages.user, page: () => const UserPage(), binding: UserBinding()), - GetPage( - name: AppPages.tab, page: () => const TabPage(), binding: TabBinding()), ]; }