This commit is contained in:
2024-01-04 16:41:51 +08:00
parent 55085ee563
commit 47f82097e2
22 changed files with 483 additions and 645 deletions

View File

@@ -0,0 +1,46 @@
import 'package:get/get.dart';
import 'data_count_state.dart';
class DataCountLogic extends GetxController {
final DataCountState state = DataCountState();
final List<Map<String, String>> 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();
}
}

View File

@@ -0,0 +1,5 @@
class DataCountState {
DataCountState() {
///Initialize variables
}
}

View File

@@ -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<DataCountLogic>().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());
}
}

View File

@@ -0,0 +1,5 @@
library data_count_component;
export './data_count_logic.dart';
export './data_count_state.dart';
export './data_count_view.dart';

View File

@@ -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();
}
}

View File

@@ -0,0 +1,5 @@
class HeaderState {
HeaderState() {
///Initialize variables
}
}

View File

@@ -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<HeaderLogic>().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,
))
],
)
],
);
}
}

View File

@@ -0,0 +1,5 @@
library header_component;
export './header_logic.dart';
export './header_state.dart';
export './header_view.dart';

View File

@@ -0,0 +1,5 @@
library menu_component;
export './menu_view.dart';
export './menu_state.dart';
export './menu_logic.dart';

View File

@@ -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);
}
}

View File

@@ -0,0 +1,5 @@
class MenuState {
MenuState() {
///Initialize variables
}
}

View File

@@ -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<MenuLogic>().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()),
);
}
}

View File

@@ -0,0 +1,5 @@
library order_card_component;
export './order_card_logic.dart';
export './order_card_state.dart';
export './order_card_view.dart';

View File

@@ -0,0 +1,53 @@
import 'package:get/get.dart';
import 'order_card_state.dart';
class OrderCardLogic extends GetxController {
final OrderCardState state = OrderCardState();
final List<Map<String, String>> 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,
});
}
}

View File

@@ -0,0 +1,5 @@
class OrderCardState {
OrderCardState() {
///Initialize variables
}
}

View File

@@ -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<OrderCardLogic>().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()),
);
}
}