commission_logic.dart
2.5 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
75
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import '../../../../common/colors.dart';
import '../../../../utils/log.dart';
class CommissionLogic extends GetxController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
///选择日期
void selectDate() {
Get.bottomSheet(
Container(
height: 350,
color: Colors.white,
child: Column(
children: [
Container(
height: 40,
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('选择日期', style: TextStyle(fontSize: 18, color: ColorConfig.color33, fontWeight: FontWeight.bold),),
InkWell(
child: Container(
width: 60,
height: 26,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4)),
color: ColorConfig.themeColor
),
child: Text('确定', style: TextStyle(color: ColorConfig.white, fontSize: 15),),
),
onTap: () { Get.back(); },
)
],
),
),
SfDateRangePicker(
onSelectionChanged: _onSelectionChanged,
selectionMode: DateRangePickerSelectionMode.range,
initialSelectedRange: PickerDateRange(
DateTime.now().subtract(const Duration(days: 7)),
DateTime.now().subtract(const Duration(days: 1))),
)
],
),
)
);
}
void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
var aaa;
if (args.value is PickerDateRange) {
aaa = '${args.value.startDate} -'
' ${args.value.endDate ?? args.value.startDate}';
} else if (args.value is DateTime) {
aaa = args.value.toString();
} else if (args.value is List<DateTime>) {
aaa = args.value.length.toString();
} else {
aaa = args.value.length.toString();
}
LogUtils.e('--------${aaa}');
}
}