Commit c27c11c0b0765ff4c91e74c29c4daba2fcf9fc18

Authored by wdn127929
1 parent 9f1a868d

设置小程序卡片样式OK

import 'dart:convert';
import 'package:flutter/material.dart';
... ... @@ -20,9 +19,6 @@ import '../../../widgets/MyDivider.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/page_exception.dart';
import '../../../widgets/round_button.dart';
import '../../online_check/photo_view_wiget.dart';
import 'dart:convert' as convert;
import 'dart:math' as math;
... ... @@ -45,13 +41,31 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
late MarketingCenterProvider marketingCenterProvider;
ScrollController controller = ScrollController();
String? miniType;
String miniType = '2-3';
late PageController pageController;
double? pageOffset = 0;
SwiperController swiperController = SwiperController();
List<String?> types = ['0', '1', '2', '3'];
List<String> types = [
'0',
'1-1',
'1-2',
'1-3',
'1-4',
'2-1',
'2-2',
'2-3',
'2-4',
'3-1',
'3-2',
'3-3',
'3-4',
'4-1',
'4-2',
'4-3',
'4-4',
];
User? user;
... ... @@ -75,7 +89,7 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
showLoading: false, selfDismiss: true);
if (success) {
marketingCenterProvider.pageStateSettingMini = PageState.Success;
miniType = marketingCenterProvider.dzSellerConfModel!.liteStyle ?? '3';
miniType = marketingCenterProvider.dzSellerConfModel!.liteStyle ?? '2-3';
tilteContentC.text = marketingCenterProvider
.dzSellerConfModel!.liteStyleTitle ??
"您预订的${Provider.of<UserModel>(context, listen: false).user!.sellername},已经安排,点击查看详情";
... ... @@ -91,7 +105,7 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
}
String returnWeek(DateTime day, BuildContext context) {
String date = "周${Utils.formatWeekDayNum(day.weekday)} ";
String date = "周${Utils.formatWeekDayNum(day.weekday)} ";
return date;
}
... ... @@ -103,7 +117,7 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
user = Provider.of<UserModel>(context, listen: false).user;
return Scaffold(
backgroundColor: MyColours.color_ffffff,
backgroundColor: MyColours.color_f3f3f3,
appBar: SystemAppBar('小程序通知卡片样式'),
body: Consumer<MarketingCenterProvider>(builder: (context1, model, _) {
if (model.pageStateSettingMini != PageState.Success) {
... ... @@ -138,6 +152,7 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
right: w(20),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(10)),
border: Border.all(
width: w(1), color: MyColours.color_DBDBDB)),
... ... @@ -198,16 +213,16 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
color: MyColours.color_E7E7E7)),
VEmptyView(240),
Container(
height: w(145),
height: w(168),
child: Swiper(
controller: swiperController,
itemBuilder: (BuildContext context, int index) {
if (types[index] == '0') {
return Container(
color: Color.fromRGBO(81, 81, 81, 0.4),
color: MyColours.color_99000000,
padding: EdgeInsets.symmetric(horizontal: w(10)),
width: w(180),
height: h(145),
width: w(210),
height: h(168),
alignment: Alignment.center,
child: Text(
'无样式',
... ... @@ -219,56 +234,411 @@ class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
fontSize: font(20)),
),
);
}
return Container(
color: Color.fromRGBO(81, 81, 81, 0.4),
padding: EdgeInsets.symmetric(horizontal: w(10)),
width: w(180),
height: h(145),
child: Column(
children: [
VEmptyView(20),
Text(
'${Provider.of<UserModel>(context, listen: false).user!.sellername}',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontSize: font(12)),
} else {
List<String> subType = types[index].split('-');
String subType0 = subType[0]; //几号模版
String subType1 = subType[1]; //模版下面的子样式
if (subType0 == '1') {
//1号模版
String month =
'${Utils.addZeroNumber(DateTime.now().month)}月${Utils.addZeroNumber(DateTime.now().day)}日 ';
String week = returnWeek(DateTime.now(), context);
String hour = subType1 == '1' || subType1 == '3'
? (user!.noon != '00:00'
? '${user!.noon!.split('-')[0]} '
: '14:30 ')
: '';
String section =
subType1 == '1' || subType1 == '4'
? '午餐'
: subType1 == '2'
? '中午'
: '';
String time = month + week + hour + section;
return Container(
color: MyColours.color_ffffff,
// width: w(210),
height: h(168),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Container(
alignment: Alignment.center,
// color: Color.fromRGBO(81, 81, 81, 0.4),
color: MyColours.color_99000000,
width: w(210),
height: h(26),
child: Text(
'${Provider.of<UserModel>(context, listen: false).user!.sellername}',
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_FFEFC5,
fontSize: font(12)),
)),
Container(
alignment: Alignment.center,
// color: Color.fromRGBO(81, 81, 81, 0.4),
color: MyColours.color_99000000,
width: w(210),
height: h(26),
child: Text(
time,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(12)),
)),
],
),
VEmptyView(50),
Text(
'${Utils.addZeroNumber(DateTime.now().month)}月${Utils.addZeroNumber(DateTime.now().day)}日',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(20)),
);
} else if (subType0 == '2') {
//2号模版
String week = returnWeek(DateTime.now(), context);
String hour = subType1 == '1' || subType1 == '3'
? (user!.noon != '00:00'
? '${user!.noon!.split('-')[0]} '
: '14:30 ')
: '';
String section =
subType1 == '1' || subType1 == '4'
? '午餐'
: subType1 == '2'
? '中午'
: '';
String time = week + hour + section;
return Container(
// color: Color.fromRGBO(81, 81, 81, 0.4),
color: MyColours.color_99000000,
padding:
EdgeInsets.symmetric(horizontal: w(10)),
width: w(210),
height: h(168),
child: Column(
children: [
VEmptyView(66),
Text(
'${Provider.of<UserModel>(context, listen: false).user!.sellername}',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_FFEFC5,
fontSize: font(12)),
),
VEmptyView(60),
Text(
'${Utils.addZeroNumber(DateTime.now().month)}/${Utils.addZeroNumber(DateTime.now().day)}',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(24)),
),
VEmptyView(8),
Text(
time,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(12)),
)
],
),
VEmptyView(10),
Text(
returnWeek(DateTime.now(), context) +
(types[index] == '1'
);
} else if (subType0 == '3') {
//3号模版
String month =
'${Utils.addZeroNumber(DateTime.now().month)}月${Utils.addZeroNumber(DateTime.now().day)}日 ';
String week = returnWeek(DateTime.now(), context);
String hour = subType1 == '1' || subType1 == '3'
? (user!.noon != '00:00'
? '${user!.noon!.split('-')[0]}'
: '14:30')
: '';
String section =
subType1 == '1' || subType1 == '4'
? '午餐'
: subType1 == '2'
? '中午'
: types[index] == '2'
? (user!.noon != '00:00'
? user!.noon!.split('-')[0]
: '14:30')
: '午餐'),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(18)),
)
],
),
);
: '';
if (hour != '') {
section = section + ' ';
}
String time = section + hour;
return Container(
color: MyColours.color_99000000,
width: w(210),
height: h(168),
padding: EdgeInsets.only(
right: w(20), bottom: w(20)),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(
top: w(20),
left: w(12),
right: w(12)),
// color: Color.fromRGBO(81, 81, 81, 0.4),
width: w(210),
// height: h(26),
child: Text(
'${Provider.of<UserModel>(context, listen: false).user!.sellername}',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_FFEFC5,
fontSize: font(12)),
)),
Column(
// crossAxisAlignment:
// CrossAxisAlignment.stretch,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Container(
alignment: Alignment.centerRight,
height: w(34),
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Text(
month,
textAlign: TextAlign.center,
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: MyColours
.color_FFEFC5,
fontWeight:
FontWeight.bold,
fontSize: font(24)),
),
Container(
width: w(10),
height: w(34),
child: Text(
week,
textAlign:
TextAlign.center,
maxLines: 3,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
// writingMode: TextWritingMode.verticalLr,
color: MyColours
.color_FFEFC5,
fontWeight:
FontWeight.bold,
fontSize: font(12)),
)),
],
)),
VEmptyView(14),
Container(
child: Container(
// constraints: BoxConstraints(
// maxWidth: w(300)),
decoration: BoxDecoration(
color: MyColours
.color_66FFEFC5,
borderRadius:
BorderRadius.circular(
r(3))),
padding: EdgeInsets.symmetric(
horizontal: w(4),
vertical: w(3)),
// height: h(26),
child: Text(
time,
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: MyColours
.color_FFEFC5,
fontWeight:
FontWeight.bold,
fontSize: font(10)),
))),
],
),
],
),
);
} else {
//4号模版
String month =
'${Utils.addZeroNumber(DateTime.now().month)}/${Utils.addZeroNumber(DateTime.now().day)} ';
String week = returnWeek(DateTime.now(), context);
String hour = subType1 == '1' || subType1 == '3'
? (user!.noon != '00:00'
? '${user!.noon!.split('-')[0]}'
: '14:30')
: '';
String section =
subType1 == '1' || subType1 == '4'
? '午餐'
: subType1 == '2'
? '中午'
: '';
if (section != '') {
hour = hour + ' ';
}
String time = hour + section;
return Container(
color: MyColours.color_ffffff,
width: w(210),
height: h(168),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Spacer(),
Container(
// height: w(45),
color: MyColours.color_99000000,
padding: EdgeInsets.only(
top: w(8),
left: w(8),
bottom: w(8),
right: w(13)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'${Provider.of<UserModel>(context, listen: false).user!.sellername}',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_FFEFC5,
fontSize: font(10)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Container(
alignment:
Alignment.centerRight,
// height: w(34),
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Text(
month,
textAlign:
TextAlign.right,
maxLines: 1,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
color: MyColours
.color_FFEFC5,
fontWeight:
FontWeight
.bold,
fontSize:
font(10)),
),
HEmptyView(10),
Container(
// width: w(10),
// height: w(34),
child: Text(
week,
textAlign:
TextAlign.right,
// maxLines: 3,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
// writingMode: TextWritingMode.verticalLr,
color: MyColours
.color_FFEFC5,
fontWeight:
FontWeight
.bold,
fontSize:
font(10)),
)),
],
)),
VEmptyView(8),
Container(
alignment: Alignment.center,
width: w(60),
height: w(13),
// constraints: BoxConstraints(
// maxWidth: w(300)),
decoration: BoxDecoration(
color: MyColours
.color_66FFEFC5,
borderRadius:
BorderRadius
.circular(
r(3))),
// padding:
// EdgeInsets.symmetric(
// horizontal: w(4),
// vertical: w(3)),
// height: h(26),
child: Text(
time,
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: MyColours
.color_FFEFC5,
fontWeight:
FontWeight.bold,
fontSize: font(10)),
)),
],
),
],
)),
],
),
);
}
}
},
onTap: (v) {
print(v);
... ...
... ... @@ -31,6 +31,8 @@ class MyColours {
static const Color color_F7C797 = Color(0xffF7C797);
static const Color color_FEF3E6 = Color(0xffFEF3E6);
static const Color color_66000000 = Color(0x66000000);
static const Color color_66FFEFC5= Color(0x66FFEFC5);
static const Color color_00A870 = Color(0xff00A870);
static const Color color_F6F6F6 = Color(0xffF6F6F6);
static const Color color_E6000000 = Color(0xE6000000);
... ...