git
This commit is contained in:
5
lib/pages/layout/home/components/order_card/index.dart
Normal file
5
lib/pages/layout/home/components/order_card/index.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
library order_card_component;
|
||||
|
||||
export './order_card_logic.dart';
|
||||
export './order_card_state.dart';
|
||||
export './order_card_view.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<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,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class OrderCardState {
|
||||
OrderCardState() {
|
||||
///Initialize variables
|
||||
}
|
||||
}
|
||||
@@ -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()),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user