Commit 339624d9d0353c571691401af92b5654c0978648

Authored by wdn127929
1 parent 93ffde6b

选择主题数据准备

@@ -36,11 +36,13 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -36,11 +36,13 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
36 //当前店铺选中的颜色和板式 36 //当前店铺选中的颜色和板式
37 37
38 String themeColor = '摩洛哥蓝'; 38 String themeColor = '摩洛哥蓝';
39 - String themeType = '4';  
40 - int indexSelect = 0; //选中第几个模版  
41 - 39 + String themeType = '4'; //模版类型
  40 + // int indexSelectColor = 0; //选中第几个模版 (有配色选中index)
  41 + // int indexSelectNoColor = 0; //选中第几个模版 (无配色选中index)
42 List<ThemeSunModel> themeDatasno = []; 42 List<ThemeSunModel> themeDatasno = [];
43 43
  44 + ThemeModel themeModelCurrunt; //有配色对应的当前页面模版数据
  45 +
44 @override 46 @override
45 void initState() { 47 void initState() {
46 super.initState(); 48 super.initState();
@@ -950,7 +952,30 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -950,7 +952,30 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
950 themeDatas['群青过渡'] = themeModel1; 952 themeDatas['群青过渡'] = themeModel1;
951 } 953 }
952 954
  955 + _selectTheme(String id) {
  956 + List<ThemeSunModel> temp = [];
  957 + temp.addAll(themeModelCurrunt.urls);
  958 + temp.addAll(themeDatasno);
  959 + List<String> tempUrls = temp.map((e) => e.url).toList();
  960 +
  961 + // List<String> temp =
  962 + // themeModel.urls.map((e) => e.url).toList();
  963 + // print(temp);
  964 +
  965 + // List<String> temp =
  966 + // themeDatasno.map((e) => e.url).toList();
  967 + print(temp);
  968 + _showPhotoView(
  969 + context, temp.indexWhere((element) => element.id == id), tempUrls,
  970 + (index) {
  971 + //选中的index
  972 + themeType = temp[index].id; //当前选中模版的id
  973 + setState(() {});
  974 + });
  975 + }
  976 +
953 _showPhotoView(BuildContext context, int index, List<String> imgs, 977 _showPhotoView(BuildContext context, int index, List<String> imgs,
  978 + CustomCallBack callback,
954 {isShow = false, List dashName}) async { 979 {isShow = false, List dashName}) async {
955 // if (imgs.length == 1 && 980 // if (imgs.length == 1 &&
956 // imgs[0] == 981 // imgs[0] ==
@@ -971,30 +996,42 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -971,30 +996,42 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
971 alignment: Alignment.bottomCenter, 996 alignment: Alignment.bottomCenter,
972 children: <Widget>[ 997 children: <Widget>[
973 PhotoPreview( 998 PhotoPreview(
974 - initialIndex: index,  
975 - photoList: imgs,  
976 - isShow: isShow,  
977 - dashName: dashName),  
978 - Positioned(  
979 - bottom: w(20),  
980 - child: Container(  
981 - padding: EdgeInsets.symmetric(  
982 - horizontal: w(30), vertical: w(10)),  
983 - decoration: BoxDecoration(  
984 - color: MyColours.color_ffffff,  
985 - borderRadius: BorderRadius.circular(r(30)),  
986 - ),  
987 - child: Text(  
988 - '应用主题',  
989 - style: TextStyle(  
990 - decoration: TextDecoration.none,  
991 - color: MyColours.color_515151,  
992 - fontSize: font(16)),  
993 - ),  
994 - )) 999 + initialIndex: index,
  1000 + photoList: imgs,
  1001 + isShow: isShow,
  1002 + dashName: dashName,
  1003 + needMask: false,
  1004 + needTap: false,
  1005 + callback: (curruntIndex) {
  1006 + //选中某个模版
  1007 + callback(curruntIndex);
  1008 + },
  1009 + ),
  1010 + // Positioned(
  1011 + // bottom: w(20),
  1012 + // child: InkWell(
  1013 + // onTap: () {
  1014 + // callback(index);
  1015 + // },
  1016 + // child: Container(
  1017 + // padding: EdgeInsets.symmetric(
  1018 + // horizontal: w(30), vertical: w(10)),
  1019 + // decoration: BoxDecoration(
  1020 + // color: MyColours.color_ffffff,
  1021 + // borderRadius: BorderRadius.circular(r(30)),
  1022 + // ),
  1023 + // child: Text(
  1024 + // '应用',
  1025 + // style: TextStyle(
  1026 + // decoration: TextDecoration.none,
  1027 + // color: MyColours.color_515151,
  1028 + // fontSize: font(16)),
  1029 + // ),
  1030 + // ),
  1031 + // ))
995 ], 1032 ],
996 ); 1033 );
997 - return child; 1034 + return Material(child: child);
998 }); 1035 });
999 Utils.setBarStatus(true, color: Colors.white); 1036 Utils.setBarStatus(true, color: Colors.white);
1000 } 1037 }
@@ -1091,28 +1128,28 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -1091,28 +1128,28 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
1091 childAspectRatio: 1128 childAspectRatio:
1092 (ScreenUtil().screenWidth - w(62)) / 2 / 370), 1129 (ScreenUtil().screenWidth - w(62)) / 2 / 370),
1093 itemBuilder: (BuildContext context, int index) { 1130 itemBuilder: (BuildContext context, int index) {
1094 - ThemeModel themeModel = themeDatas[themeColor]; 1131 + themeModelCurrunt = themeDatas[themeColor];
1095 return InkWell( 1132 return InkWell(
1096 onTap: () { 1133 onTap: () {
1097 - List<String> temp =  
1098 - themeModel.urls.map((e) => e.url).toList();  
1099 - print(temp);  
1100 - _showPhotoView(context, indexSelect,  
1101 - themeModel.urls.map((e) => e.url).toList()); 1134 + _selectTheme(themeDatas[themeColor].urls[index].id);
1102 }, 1135 },
1103 child: Container( 1136 child: Container(
1104 decoration: BoxDecoration( 1137 decoration: BoxDecoration(
1105 borderRadius: BorderRadius.circular(r(10)), 1138 borderRadius: BorderRadius.circular(r(10)),
1106 border: Border.all( 1139 border: Border.all(
1107 - color: indexSelect == index 1140 + color: themeType ==
  1141 + themeModelCurrunt.urls[index].id
1108 ? MyColours.color_005AA7 1142 ? MyColours.color_005AA7
1109 : MyColours.color_DBDBDB, 1143 : MyColours.color_DBDBDB,
1110 - width: indexSelect == index ? w(2) : w(1))), 1144 + width: themeType ==
  1145 + themeModelCurrunt.urls[index].id
  1146 + ? w(2)
  1147 + : w(1))),
1111 child: Column( 1148 child: Column(
1112 children: [ 1149 children: [
1113 VEmptyView(10), 1150 VEmptyView(10),
1114 CachedNetworkImage( 1151 CachedNetworkImage(
1115 - imageUrl: themeModel.urls[index].url, 1152 + imageUrl: themeModelCurrunt.urls[index].url,
1116 width: (ScreenUtil().screenWidth - w(62)) / 2, 1153 width: (ScreenUtil().screenWidth - w(62)) / 2,
1117 height: w(348), 1154 height: w(348),
1118 fit: BoxFit.fitWidth, 1155 fit: BoxFit.fitWidth,
@@ -1124,7 +1161,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -1124,7 +1161,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
1124 vertical: w(6), horizontal: w(2)), 1161 vertical: w(6), horizontal: w(2)),
1125 width: double.infinity, 1162 width: double.infinity,
1126 child: Text( 1163 child: Text(
1127 - themeModel.urls[index].name, 1164 + themeModelCurrunt.urls[index].name,
1128 maxLines: 1, 1165 maxLines: 1,
1129 overflow: TextOverflow.ellipsis, 1166 overflow: TextOverflow.ellipsis,
1130 textAlign: TextAlign.left, 1167 textAlign: TextAlign.left,
@@ -1147,7 +1184,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -1147,7 +1184,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
1147 callback: (object) { 1184 callback: (object) {
1148 print(object); 1185 print(object);
1149 setState(() { 1186 setState(() {
1150 - indexSelect = object; 1187 + themeColor = object;
1151 }); 1188 });
1152 }); 1189 });
1153 }, 1190 },
@@ -1220,21 +1257,30 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { @@ -1220,21 +1257,30 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
1220 itemBuilder: (BuildContext context, int index) { 1257 itemBuilder: (BuildContext context, int index) {
1221 ThemeSunModel themeModel = themeDatasno[index]; 1258 ThemeSunModel themeModel = themeDatasno[index];
1222 return InkWell( 1259 return InkWell(
  1260 + // onTap: () {
  1261 + // List<String> temp =
  1262 + // themeDatasno.map((e) => e.url).toList();
  1263 + // print(temp);
  1264 + // _showPhotoView(context, index,
  1265 + // themeDatasno.map((e) => e.url).toList(), (index) {
  1266 + // //
  1267 + // themeType = themeDatasno[index].id;
  1268 + // setState(() {});
  1269 + // });
  1270 + // },
1223 onTap: () { 1271 onTap: () {
1224 - List<String> temp =  
1225 - themeDatasno.map((e) => e.url).toList();  
1226 - print(temp);  
1227 - _showPhotoView(context, indexSelect,  
1228 - themeDatasno.map((e) => e.url).toList()); 1272 + _selectTheme(themeModel.id);
1229 }, 1273 },
1230 child: Container( 1274 child: Container(
1231 decoration: BoxDecoration( 1275 decoration: BoxDecoration(
1232 borderRadius: BorderRadius.circular(r(10)), 1276 borderRadius: BorderRadius.circular(r(10)),
1233 border: Border.all( 1277 border: Border.all(
1234 - color: indexSelect == index 1278 + color: themeType == themeDatasno[index].id
1235 ? MyColours.color_005AA7 1279 ? MyColours.color_005AA7
1236 : MyColours.color_DBDBDB, 1280 : MyColours.color_DBDBDB,
1237 - width: indexSelect == index ? w(2) : w(1))), 1281 + width: themeType == themeDatasno[index].id
  1282 + ? w(2)
  1283 + : w(1))),
1238 child: Column( 1284 child: Column(
1239 children: [ 1285 children: [
1240 VEmptyView(10), 1286 VEmptyView(10),
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
5 import 'package:cached_network_image/cached_network_image.dart'; 5 import 'package:cached_network_image/cached_network_image.dart';
6 import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 import 'package:one_key/res/colors.dart'; 7 import 'package:one_key/res/colors.dart';
  8 +import 'package:one_key/utils/pick_date_nonli_gongli/pick_calendar_month.dart';
8 import 'package:photo_view/photo_view.dart'; 9 import 'package:photo_view/photo_view.dart';
9 import 'package:photo_view/photo_view_gallery.dart'; 10 import 'package:photo_view/photo_view_gallery.dart';
10 11
@@ -16,13 +17,17 @@ class PhotoPreview extends StatefulWidget { @@ -16,13 +17,17 @@ class PhotoPreview extends StatefulWidget {
16 final bool isShow; 17 final bool isShow;
17 final List dashName; 18 final List dashName;
18 final bool needMask; 19 final bool needMask;
  20 + final bool needTap;
  21 + final CustomCallBack callback;
19 22
20 PhotoPreview( 23 PhotoPreview(
21 {this.initialIndex, 24 {this.initialIndex,
22 this.photoList, 25 this.photoList,
23 this.isShow, 26 this.isShow,
24 this.dashName, 27 this.dashName,
25 - this.needMask = true}) 28 + this.needMask = true,
  29 + this.needTap = true,
  30 + this.callback})
26 : pageController = PageController(initialPage: initialIndex); 31 : pageController = PageController(initialPage: initialIndex);
27 32
28 @override 33 @override
@@ -71,6 +76,11 @@ class _PhotoPreviewState extends State<PhotoPreview> { @@ -71,6 +76,11 @@ class _PhotoPreviewState extends State<PhotoPreview> {
71 child: InkWell( 76 child: InkWell(
72 onTap: () { 77 onTap: () {
73 Navigator.of(context).pop(); 78 Navigator.of(context).pop();
  79 + if (!widget.needTap) {
  80 + if (widget.callback != null) {
  81 + widget.callback(currentIndex);
  82 + }
  83 + }
74 }, 84 },
75 child: Container( 85 child: Container(
76 decoration: BoxDecoration( 86 decoration: BoxDecoration(