diff --git a/lib/base/base_style.dart b/lib/base/base_style.dart index 0c1dbbf0..c3a4a239 100644 --- a/lib/base/base_style.dart +++ b/lib/base/base_style.dart @@ -8,6 +8,7 @@ const kForeGroundColor = Color(0xFFFFFFFF); const kPrimaryColor=Color(0xFFFFC40C); const kDarkPrimaryColor=Color(0xFFFF8200); const kDangerColor=Color(0xFFFF3B30); +const kEstateName='宁波华悦茂峰'; class BaseStyle { ///字体类 static final double fontSize18 = 18.sp; diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 19aa5b88..6f6db79a 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -61,5 +61,5 @@ class _Manager { String get fixedSubmit => '/user/reportRepair/list'; ///添加填写的访客信息 - String get insertVisitorInfo => 'user/visitorAccess/insertVisitorInfo'; + String get insertVisitorInfo => '/user/visitorAccess/insertVisitorInfo'; } diff --git a/lib/model/user/user_detail_model.dart b/lib/model/user/user_detail_model.dart index f21048c2..42628655 100644 --- a/lib/model/user/user_detail_model.dart +++ b/lib/model/user/user_detail_model.dart @@ -48,6 +48,9 @@ class UserDetailModel { roomStatus = json['roomStatus']; nickName = json['nickName']; estateNames = json['estateNames'].cast(); + if (json['estateNames']==null) { + estateNames=[]; + } } Map toJson() { diff --git a/lib/pages/community/widget/trend_card.dart b/lib/pages/community/widget/trend_card.dart index 6afd7c7e..eb85b937 100644 --- a/lib/pages/community/widget/trend_card.dart +++ b/lib/pages/community/widget/trend_card.dart @@ -1,12 +1,12 @@ import 'dart:ui'; import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/expandable_text.dart'; -import 'package:akuCommunity/widget/image_grid.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -177,7 +177,7 @@ class _TrendCardState extends State { padding: EdgeInsets.only(left: 95.w), child: Column( children: [ - ImageGrid(widget.imageUrl), + HorizontalImageView(widget.imageUrl), SizedBox(height: 20.w), Stack( children: [ diff --git a/lib/pages/convenient_phone/convenient_phone_page.dart b/lib/pages/convenient_phone/convenient_phone_page.dart index 6d4d3b5d..1f22ffae 100644 --- a/lib/pages/convenient_phone/convenient_phone_page.dart +++ b/lib/pages/convenient_phone/convenient_phone_page.dart @@ -45,7 +45,7 @@ class _ConvenientPhonePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ model.name.text.black.size(32.sp).make(), - 12.heightBox, + 12.w.heightBox, model.tel.text.color(Color(0xFF999999)).size(28.sp).make(), ], ).expand(), @@ -70,7 +70,7 @@ class _ConvenientPhonePageState extends State { // child: Column( // children: [ // title.text.black.size(32.sp).make(), - // 45.heightBox, + // 45.w.heightBox, // ], // ), // ), diff --git a/lib/pages/goods_details/widget/goods_comments_card.dart b/lib/pages/goods_details/widget/goods_comments_card.dart index 58f359c6..3206d26f 100644 --- a/lib/pages/goods_details/widget/goods_comments_card.dart +++ b/lib/pages/goods_details/widget/goods_comments_card.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; @@ -5,7 +6,6 @@ import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/widget/cached_image_wrapper.dart'; import 'package:akuCommunity/widget/expandable_text.dart'; -import 'package:akuCommunity/widget/image_grid.dart'; class GoodsCommentsCard extends StatefulWidget { final String imagePath, @@ -97,7 +97,7 @@ class _GoodsCommentsCardState extends State { expand: false, ), ), - ImageGrid(contentImageList), + HorizontalImageView(contentImageList), ], ), ); diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 05103079..482a9bd3 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -1,6 +1,7 @@ import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/net_util.dart'; +import 'package:flustars/flustars.dart'; class ManagerFunc { static insertVisitorInfo(int id, int type, String name, int sex, String tel, @@ -13,7 +14,7 @@ class ManagerFunc { 'sex': sex, 'tel': tel, 'carNum': carNum, - 'expectedVisitDate': expectedVisitDate.toIso8601String(), + 'expectedVisitDate': DateUtil.formatDate(expectedVisitDate,format: "yyyy-MM-dd HH:mm:ss") }, showMessage: true); return baseModel; diff --git a/lib/pages/personal/change_nick_name_page.dart b/lib/pages/personal/change_nick_name_page.dart index 32ce4a46..59ae6b1c 100644 --- a/lib/pages/personal/change_nick_name_page.dart +++ b/lib/pages/personal/change_nick_name_page.dart @@ -41,7 +41,7 @@ class _ChangeNickNameState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 55.heightBox, + 55.w.heightBox, '昵称'.text.black.size(28.sp).make(), TextFormField( controller: _textEditingController, @@ -59,7 +59,7 @@ class _ChangeNickNameState extends State { )), ), ), - 150.heightBox, + 150.w.heightBox, MaterialButton( onPressed: () { userProvider.setName(_textEditingController.text); @@ -71,7 +71,7 @@ class _ChangeNickNameState extends State { minWidth: 686.w, height: 85.w, ), - 24.heightBox, + 24.w.heightBox, '为保护个人隐私,在与邻里交往时显示昵称,默认为真实姓名,您可自行修改' .text .color(Color(0xFF999999)) diff --git a/lib/pages/personal/update_tel_page.dart b/lib/pages/personal/update_tel_page.dart index 695aeb0e..e4fcf7fb 100644 --- a/lib/pages/personal/update_tel_page.dart +++ b/lib/pages/personal/update_tel_page.dart @@ -69,7 +69,7 @@ class _UpdateTelPageState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w), child: ListView( children: [ - 55.heightBox, + 55.w.heightBox, '旧号码'.text.black.size(28.sp).make(), TextFormField( inputFormatters: [ @@ -88,7 +88,7 @@ class _UpdateTelPageState extends State { )), ), ), - 24.heightBox, + 24.w.heightBox, '新号码'.text.black.size(28.sp).make(), TextFormField( inputFormatters: [ @@ -141,7 +141,7 @@ class _UpdateTelPageState extends State { ), ), ), - 24.heightBox, + 24.w.heightBox, '验证码'.text.black.size(28.sp).make(), TextFormField( inputFormatters: [ @@ -160,7 +160,7 @@ class _UpdateTelPageState extends State { )), ), ), - 64.heightBox, + 64.w.heightBox, MaterialButton( onPressed: () { if (TextUtil.isEmpty(_oldTelController.text)) { @@ -181,7 +181,7 @@ class _UpdateTelPageState extends State { minWidth: 686.w, height: 85.w, ), - 24.heightBox, + 24.w.heightBox, '注:新手机号将作为您的登录凭证' .text .color(Color(0xFF999999)) diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index 608e9fd6..90206992 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -1,8 +1,8 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/user/fixed_submit_model.dart'; +import 'package:akuCommunity/pages/things_page/widget/add_fixed_submit_page.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; -import 'package:akuCommunity/pages/things_page/widget/image_grid.dart'; import 'package:akuCommunity/utils/bee_map.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/horizontal_image_view.dart'; @@ -11,6 +11,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/extensions/num_ext.dart'; +import 'package:akuCommunity/extensions/page_router.dart'; class FixedSubmitPage extends StatefulWidget { FixedSubmitPage({Key key}) : super(key: key); @@ -117,13 +118,15 @@ class _FixedSubmitPageState extends State { return _buildCard(items[index]); }, separatorBuilder: (context, index) { - return 24.heightBox; + return 24.w.heightBox; }, itemCount: items.length); }, ).expand(), MaterialButton( - onPressed: () {}, + onPressed: () { + AddFixedSubmitPage().to(); + }, child: '新增'.text.bold.color(ktextPrimary).size(32.sp).make(), minWidth: double.infinity, height: 98.w, diff --git a/lib/pages/things_page/things_detail_page/things_detail_page.dart b/lib/pages/things_page/things_detail_page/things_detail_page.dart index 3202451a..fb553faa 100644 --- a/lib/pages/things_page/things_detail_page/things_detail_page.dart +++ b/lib/pages/things_page/things_detail_page/things_detail_page.dart @@ -1,11 +1,11 @@ import 'package:akuCommunity/pages/things_page/things_evaluate_page/things_evaluate_page.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/expandable_text.dart'; import 'package:akuCommunity/routers/page_routers.dart'; -import '../widget/image_grid.dart'; import 'widget/goods_info_card.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -53,7 +53,7 @@ class _ThingsDetailPageState extends State { expand: false, ), SizedBox(height: 29.w), - imageList.length != 0 ? ImageGrid(imageList) : SizedBox(), + imageList.length != 0 ? HorizontalImageView(imageList) : SizedBox(), SizedBox(height: 24.w), Text( time, diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart new file mode 100644 index 00000000..a7cd313e --- /dev/null +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -0,0 +1,211 @@ +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/widget/bee_divider.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:akuCommunity/const/resource.dart'; +import 'package:akuCommunity/extensions/widget_list_ext.dart'; + +class AddFixedSubmitPage extends StatefulWidget { + AddFixedSubmitPage({Key key}) : super(key: key); + + @override + _AddFixedSubmitPageState createState() => _AddFixedSubmitPageState(); +} + +class _AddFixedSubmitPageState extends State { + List _buttons = ['公区保修', '家庭维修']; + int _groupValue; + Widget _buildHouseCard( + String title, + String detail, + ) { + return Padding( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '报修房屋'.text.black.size(28.sp).make(), + 32.w.heightBox, + GestureDetector( + onTap: () {}, + child: Row( + children: [ + Image.asset( + R.ASSETS_ICONS_HOUSE_PNG, + width: 60.w, + height: 60.w, + ), + 40.w.widthBox, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title.text.black.size(32.sp).bold.make(), + 10.w.heightBox, + detail.text.black.size(32.sp).bold.make() + ], + ), + ), + // Icon( + // CupertinoIcons.chevron_forward, + // size: 40.w, + // ), + ], + ), + ), + 24.w.heightBox, + BeeDivider.horizontal(), + ], + ), + ); + } + + Widget _selectButton( + String title, + int value, + ) { + return FlatButton( + minWidth: 200.w, + height: 72.w, + onPressed: () { + setState(() { + _groupValue = value; + }); + }, + child: title.text + .color(_groupValue == value ? ktextPrimary : ktextSubColor) + .size(32.sp) + .make(), + padding: EdgeInsets.symmetric(horizontal: 34.w, vertical: 14.w), + shape: RoundedRectangleBorder( + side: BorderSide( + color: _groupValue == value ? kPrimaryColor : ktextSubColor, + width: 3.w), + borderRadius: BorderRadius.circular(36.w)), + ); + } + + Widget _selectType() { + return Padding( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '请选择服务类型'.text.black.size(28.sp).make(), + 24.w.heightBox, + Row( + children: [ + ...List.generate(_buttons.length, + (index) => _selectButton(_buttons[index], index)), + ].sepWidget(separate: 20.w.widthBox), + ), + 16.w.heightBox, + ], + ), + ); + } + + Widget _buildReportCard() { + return Padding( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '请输入报修内容'.text.black.size(28.sp).make(), + 24.w.heightBox, + Container( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all(color: Color(0xFFD4CFBE), width: 1.w)), + constraints: BoxConstraints( + minHeight: 304.w, + ), + width: 686.w, + child: TextField( + maxLines: 10, + minLines: 5, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请简要描述一下你要告知我的事情,以便于我们更好的处理……', + hintStyle: TextStyle(color: ktextSubColor, fontSize: 28.sp), + contentPadding: EdgeInsets.zero, + ), + ), + ), + ], + ), + ); + } + + Widget _addImages() { + return Padding( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '添加图片信息(${0}/9)'.text.black.size(28.sp).make(), + 24.w.heightBox, + Row( + children: [ + InkWell( + onTap: () {}, + child: Container( + alignment: Alignment.center, + width: 218.w, + height: 218.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all(color: Color(0xFF979797), width: 1.w), + ), + child: '+'.text.black.size(100).bold.make(), + ), + ), + ], + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); + return BeeScaffold( + title: '报事报修', + body: Column( + children: [ + ListView( + children: [ + _buildHouseCard( + kEstateName, + userProvider.userDetailModel.estateNames.isEmpty + ? '' + : userProvider.userDetailModel.estateNames[0]), + _selectType(), + _buildReportCard(), + _addImages(), + ], + ).expand(), + MaterialButton( + minWidth: double.infinity, + height: 98.w, + onPressed: () {}, + child: '确认提交'.text.black.bold.size(32.sp).make(), + color: kPrimaryColor, + elevation: 0, + ) + .box + .padding(EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom)) + .make() + ], + ), + ); + } +} diff --git a/lib/pages/things_page/widget/image_grid.dart b/lib/pages/things_page/widget/image_grid.dart deleted file mode 100644 index f96b52b6..00000000 --- a/lib/pages/things_page/widget/image_grid.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'dart:math'; -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:akuCommunity/utils/fade_route.dart'; -import 'package:akuCommunity/widget/gallery_photo_view_wrapper.dart'; - -class ImageGrid extends StatelessWidget { - final List imageUrl; - ImageGrid(this.imageUrl, {Key key}) : super(key: key); - - final Random _random = new Random(); - int next(int min, int max) => min + _random.nextInt(max - min); - List imageModel() { - List imgList = List(); - for (int x = 0; x < imageUrl.length; x++) { - GalleryExampleItem item = GalleryExampleItem(); - item.id = '${next(x + 100, x + 1000)}'; - item.resource = imageUrl[x]; - imgList.add(item); - } - - return imgList; - } - - @override - Widget build(BuildContext context) { - return Container( - child: GridView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - crossAxisSpacing: 5, - mainAxisSpacing: 5, - ), - itemCount: imageUrl.length, - itemBuilder: (BuildContext context, int index) { - return AspectRatio( - aspectRatio: 1, - child: GalleryExampleItemThumbnail( - galleryExampleItem: imageModel()[index], - onTap: () { - Navigator.of(context).push(new FadeRoute( - page: GalleryPhotoViewWrapper( - galleryItems: imageModel(), - backgroundDecoration: const BoxDecoration( - color: Colors.black, - ), - initialIndex: index, - ), - )); - }, - ), - ); - }, - ), - ); - } -} diff --git a/lib/pages/things_page/widget/things_card.dart b/lib/pages/things_page/widget/things_card.dart index a9d20e51..af30c4a1 100644 --- a/lib/pages/things_page/widget/things_card.dart +++ b/lib/pages/things_page/widget/things_card.dart @@ -1,10 +1,10 @@ import 'package:akuCommunity/pages/things_page/things_detail_page/things_detail_page.dart'; +import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/widget/expandable_text.dart'; -import 'image_grid.dart'; class ThingsCard extends StatefulWidget { final String time, tag, content; @@ -76,7 +76,7 @@ class _ThingsCardState extends State { expand: false, ), SizedBox(height: 29.w), - imageList.length != 0 ? ImageGrid(imageList) : SizedBox() + imageList.length != 0 ? HorizontalImageView(imageList) : SizedBox() ], ), ), diff --git a/lib/pages/visitor_access_page/visitor_access_page.dart b/lib/pages/visitor_access_page/visitor_access_page.dart index b353c252..2817f2de 100644 --- a/lib/pages/visitor_access_page/visitor_access_page.dart +++ b/lib/pages/visitor_access_page/visitor_access_page.dart @@ -9,6 +9,7 @@ import 'package:akuCommunity/base/assets_image.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/common_input.dart'; +import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -272,6 +273,7 @@ class _VisitorAccessPageState extends State { onTap: () { ManagerFunc.insertVisitorInfo(id, type, _userName.text, _selectSex, tel, _userCarNum.text, dateTime); + Get.back(); }, child: Container( alignment: Alignment.center, @@ -309,13 +311,13 @@ class _VisitorAccessPageState extends State { } Widget build(BuildContext context) { - UserProvider userProvider=Provider.of(context); + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '访客通行', actions: [ InkWell( onTap: () { - VisitorRecordPage().to; + VisitorRecordPage().to(); }, child: Container( padding: EdgeInsets.fromLTRB(32.w, 28.w, 32.w, 20.w), @@ -343,10 +345,9 @@ class _VisitorAccessPageState extends State { _selectTime(), SizedBox(height: 64.w), _create( - userProvider.userDetailModel.id, - userProvider.userDetailModel.type, - userProvider.userDetailModel.tel - ), + userProvider.userDetailModel.id, + userProvider.userDetailModel.type, + userProvider.userDetailModel.tel), _tips(), ], ), diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 919a0710..6b34c8f7 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -5,6 +5,7 @@ import 'package:akuCommunity/pages/sign/sign_func.dart'; import 'package:akuCommunity/utils/hive_store.dart'; import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/net_util.dart'; +import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; class UserProvider extends ChangeNotifier { @@ -76,11 +77,11 @@ class UserProvider extends ChangeNotifier { Future setBirthday(DateTime date) async { BaseModel baseModel = await NetUtil().post( API.user.setBirthday, - params: {'birthday': date.toIso8601String()}, + params: {'birthday': DateUtil.formatDate(date,format: "yyyy-MM-dd HH:mm:ss")}, showMessage: true, ); if (baseModel.status) { - _userInfoModel.birthday = date.toIso8601String(); + _userInfoModel.birthday = DateUtil.formatDate(date,format: "yyyy-MM-dd HH:mm:ss"); notifyListeners(); } } diff --git a/lib/widget/bee_divider.dart b/lib/widget/bee_divider.dart new file mode 100644 index 00000000..29aa5236 --- /dev/null +++ b/lib/widget/bee_divider.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class BeeDivider extends StatelessWidget { + final double thickness; + final double indent; + final double endIndent; + final Color color; + final bool isHorizontal; + BeeDivider( + {Key key, + this.thickness, + this.indent, + this.endIndent, + this.color, + this.isHorizontal}) + : super(key: key); + BeeDivider.horizontal({ + Key key, + }) : indent = 0, + endIndent = 0, + thickness = 1.w, + color = Color(0xFFE8E8E8), + isHorizontal = true, + super(key: key); + BeeDivider.vertical({ + Key key, + }) : indent = 0, + endIndent = 0, + thickness = 1.w, + color = Color(0xFFE8E8E8), + isHorizontal = false, + super(key: key); + @override + Widget build(BuildContext context) { + return isHorizontal + ? Divider( + height: 0, + thickness: this.thickness ?? 1.w, + indent: this.indent ?? 0, + endIndent: this.endIndent ?? 0, + color: this.color ?? Color(0xFFE8E8E8), + ) + : VerticalDivider( + width: 0, + thickness: this.thickness ?? 1.w, + indent: this.indent ?? 0, + endIndent: this.endIndent ?? 0, + color: this.color ?? Color(0xFFE8E8E8), + ); + } +} diff --git a/lib/widget/image_grid.dart b/lib/widget/image_grid.dart deleted file mode 100644 index f96b52b6..00000000 --- a/lib/widget/image_grid.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'dart:math'; -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:akuCommunity/utils/fade_route.dart'; -import 'package:akuCommunity/widget/gallery_photo_view_wrapper.dart'; - -class ImageGrid extends StatelessWidget { - final List imageUrl; - ImageGrid(this.imageUrl, {Key key}) : super(key: key); - - final Random _random = new Random(); - int next(int min, int max) => min + _random.nextInt(max - min); - List imageModel() { - List imgList = List(); - for (int x = 0; x < imageUrl.length; x++) { - GalleryExampleItem item = GalleryExampleItem(); - item.id = '${next(x + 100, x + 1000)}'; - item.resource = imageUrl[x]; - imgList.add(item); - } - - return imgList; - } - - @override - Widget build(BuildContext context) { - return Container( - child: GridView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - crossAxisSpacing: 5, - mainAxisSpacing: 5, - ), - itemCount: imageUrl.length, - itemBuilder: (BuildContext context, int index) { - return AspectRatio( - aspectRatio: 1, - child: GalleryExampleItemThumbnail( - galleryExampleItem: imageModel()[index], - onTap: () { - Navigator.of(context).push(new FadeRoute( - page: GalleryPhotoViewWrapper( - galleryItems: imageModel(), - backgroundDecoration: const BoxDecoration( - color: Colors.black, - ), - initialIndex: index, - ), - )); - }, - ), - ); - }, - ), - ); - } -}