diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 2b833d3b..21cfa78a 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -15,6 +15,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/store_title_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -214,8 +215,10 @@ class _CommunityCourse extends State enablePullDown: true, enablePullUp: false, header: MyHeader(), - physics: BouncingScrollPhysics(), onRefresh: _onRefresh, + onLoading: () { + }, + physics: BouncingScrollPhysics(), scrollController: scrollController, child: Container( child: SingleChildScrollView( diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart index ab83e21b..eacf14a8 100644 --- a/lib/community/headlines/article_list.dart +++ b/lib/community/headlines/article_list.dart @@ -31,6 +31,7 @@ class ArticleList extends StatefulWidget { class _ArticleList extends State { ApiService apiService; + int pageNum = 0; @override void initState() { @@ -103,7 +104,7 @@ class _ArticleList extends State { Text( widget?.articles[position]?.mainTitle ?? "", overflow: TextOverflow.ellipsis, - maxLines: 1, + maxLines: 2, style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.semi_bold, @@ -112,8 +113,8 @@ class _ArticleList extends State { ), Text( widget?.articles[position]?.viceTitle ?? "", - // overflow: TextOverflow.ellipsis, - // maxLines: 1, + overflow: TextOverflow.ellipsis, + maxLines: 3, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -123,14 +124,16 @@ class _ArticleList extends State { // SizedBox(height: 20), Row( children: [ - Text( + Expanded(child:Text( widget.articles != null?widget.articles[position]?.author?.name??"":"", + overflow: TextOverflow.ellipsis, + maxLines: 1, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF8E8E8E), ), - ), + ), ), SizedBox(width:8), Image.asset( "assets/image/browse.png", diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart index 9dabdec0..2ee53e3c 100644 --- a/lib/community/headlines/article_page.dart +++ b/lib/community/headlines/article_page.dart @@ -107,7 +107,7 @@ class _ArticlePage extends State } BaseData> baseData = await apiService.queryArticle({ "pageNum": pageNum, - "pageSize": 10, + "pageSize": 100, "searchKey": "", "state": 1, "type": 2 @@ -173,14 +173,22 @@ class _ArticlePage extends State child: SmartRefresher( controller: refreshController, enablePullDown: true, - enablePullUp: false, + enablePullUp: true, header: MyHeader(), - physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), onRefresh: _onRefresh, + onLoading: () { + queryArticleList(); + }, + physics: BouncingScrollPhysics(), scrollController: scrollController, child: Container( child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), + physics: BouncingScrollPhysics(), child: Container( color: Color(0xFFF7F7F7), margin: EdgeInsets.only(top: 16.h), @@ -227,7 +235,7 @@ class _ArticlePage extends State HeadlinesCollection(headlines,articles), ///文章列表 - ArticleList(articles), + ArticleList(articles,), ]; diff --git a/lib/community/headlines/headlines_column_details.dart b/lib/community/headlines/headlines_column_details.dart index 6f41fc03..1babbc01 100644 --- a/lib/community/headlines/headlines_column_details.dart +++ b/lib/community/headlines/headlines_column_details.dart @@ -10,7 +10,10 @@ import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/store_title_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -32,6 +35,7 @@ class _HeadlinesColumnDetails extends State HeadlinesListDetails headlinesListDetails; List headlines = []; final RefreshController refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); int pageNum = 1; @override @@ -102,169 +106,378 @@ class _HeadlinesColumnDetails extends State } } + _onRefresh(){ + queryHeadlinesDetails(widget.arguments["id"]); + queryArticleList(widget.arguments["id"]); + } + @override Widget build(BuildContext context) { - return Scaffold( - body: Container( - child: Column( - children: [ - Expanded( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - Stack( - alignment: Alignment.bottomCenter, + return Stack( + children: [ + Positioned( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: () { + queryArticleList(widget.arguments["id"]); + }, + physics: BouncingScrollPhysics(), + scrollController: scrollController, + child: Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + color: Color(0xFFF7F7F7), + child: Column( children: [ Stack( + alignment: Alignment.bottomCenter, children: [ - Positioned(child: - MImage( - headlinesListDetails?.bannerImg ?? "", - width:double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), + Stack( + children: [ + Positioned(child: + MImage( + headlinesListDetails?.bannerImg ?? "", + width:double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ], ), Container( - margin: EdgeInsets.only( - top: 50.h, left: 16.w, right: 16.w), - decoration: BoxDecoration( - color: Colors.transparent, - ), child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - GestureDetector( - child: Image.asset( - "assets/image/integral_return.png", - width: 24, - height: 24, + Padding(padding:EdgeInsets.only(left: 16), + child:Row( + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height:20.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Text( + "专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + SizedBox( + width: 6.w, + ), + Expanded( + child: Text( + headlinesListDetails?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + flex: 1, + ) + ], + ),), + Container( + width: double.infinity, + decoration: BoxDecoration( + border: Border.all( + width: 0, + color: Colors.white, + ), + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8.0), + topRight: Radius.circular(8.0), + ), + ), + margin: EdgeInsets.only(top: 16), + // padding: EdgeInsets.all(16), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding:EdgeInsets.all(16), + child: Text( + "简介:${headlinesListDetails?.introduce ?? ""}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium , + color: Colors.black, + ), + )), + ], ), - onTap: () { - Navigator.of(context).pop(); - }, ), ], ), ), ], ), - Container( - child: Column( + ListView.builder( + padding: EdgeInsets.zero, + itemCount:articles == null ? 0 : articles.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/web_page', + arguments: {"articleId": articles[position].id}); + articles[position].viewers = (articles[position].viewers + 1); + setState(() {} + ); + }, + child: articleColumnItem(articles[position]), + ); + }, + ), + ], + ), + ), + ), + ), + ), + ), + bottom:0, + top: 0, + left: 0, + right: 0, + ), + ], + ); + return Scaffold( + body: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: () { + }, + physics: BouncingScrollPhysics(), + scrollController: scrollController, + child: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + Stack( + alignment: Alignment.bottomCenter, + children: [ + Stack( children: [ - Padding(padding:EdgeInsets.only(left: 16), - child:Row( - children: [ - Container( - margin: EdgeInsets.only(right:4), - padding:EdgeInsets.only(left:2,right:2), - height:20.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(2), - color: Color(0xFF32A060), - ), - child: Text( - "专栏", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ), - SizedBox( - width: 6.w, - ), - Expanded( - child: Text( - headlinesListDetails?.name ?? "", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 18.sp, - fontWeight: MyFontWeight.semi_bold, - color: Colors.white, - ), - ), - flex: 1, - ) - ], - ),), + Positioned(child: + MImage( + headlinesListDetails?.bannerImg ?? "", + width:double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), Container( - width: double.infinity, + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), decoration: BoxDecoration( - border: Border.all( - width: 0, - color: Colors.white, - ), - color: Colors.white, - borderRadius: new BorderRadius.only( - topLeft: Radius.circular(8.0), - topRight: Radius.circular(8.0), - ), + color: Colors.transparent, ), - margin: EdgeInsets.only(top: 16), - // padding: EdgeInsets.all(16), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding(padding:EdgeInsets.all(16), - child: Text( - "简介:${headlinesListDetails?.introduce ?? ""}", - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium , - color: Colors.black, + GestureDetector( + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, ), - )), + onTap: () { + Navigator.of(context).pop(); + }, + ), ], ), ), ], ), - ), - ], - ), - ListView.builder( - padding: EdgeInsets.zero, - itemCount:articles == null ? 0 : articles.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/router/web_page', + Container( + child: Column( + children: [ + Padding(padding:EdgeInsets.only(left: 16), + child:Row( + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height:20.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Text( + "专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + SizedBox( + width: 6.w, + ), + Expanded( + child: Text( + headlinesListDetails?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + flex: 1, + ) + ], + ),), + Container( + width: double.infinity, + decoration: BoxDecoration( + border: Border.all( + width: 0, + color: Colors.white, + ), + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8.0), + topRight: Radius.circular(8.0), + ), + ), + margin: EdgeInsets.only(top: 16), + // padding: EdgeInsets.all(16), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding:EdgeInsets.all(16), + child: Text( + "简介:${headlinesListDetails?.introduce ?? ""}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium , + color: Colors.black, + ), + )), + ], + ), + ), + ], + ), + ), + ], + ), + ListView.builder( + padding: EdgeInsets.zero, + itemCount:articles == null ? 0 : articles.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/web_page', arguments: {"articleId": articles[position].id}); articles[position].viewers = (articles[position].viewers + 1); setState(() {} - ); - }, - child: articleColumnItem(articles[position]), - ); - }, - ), - ], + ); + }, + child: articleColumnItem(articles[position]), + ); + }, + ), + ], + ), ), + flex: 1, ), - flex: 1, - ), - ], + ], + ), ), ), ); } + Widget articleColumn() { + return Container( + + ); + } + Widget articleColumnItem(Article articles) { return Container( width: double.infinity, @@ -309,14 +522,16 @@ class _HeadlinesColumnDetails extends State SizedBox(height: 10), Row( children: [ - Text( - articles?.author?.name ?? "", + Expanded(child:Text( + articles?.author?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF8E8E8E), ), - ), + ),), SizedBox(width:8), Image.asset( "assets/image/browse.png", diff --git a/lib/main.dart b/lib/main.dart index 21e64be9..f5363194 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,7 +12,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/address/address_map_page.dart'; import 'package:huixiang/address/edit_address_page.dart'; import 'package:huixiang/article/hot_article_details_page.dart'; -import 'package:huixiang/article/hot_article_item.dart'; import 'package:huixiang/article/video_playback_page.dart'; import 'package:huixiang/community/community_details.dart'; import 'package:huixiang/community/release_dynamic.dart'; @@ -28,7 +27,6 @@ import 'package:huixiang/mine/coupons_page.dart'; import 'package:huixiang/mine/edit_name.dart'; import 'package:huixiang/mine/mine_card_invalid_page.dart'; import 'package:huixiang/mine/mine_card_page.dart'; -import 'package:huixiang/mine/mine_vip_level_page.dart'; import 'package:huixiang/mine/mine_wallet_page.dart'; import 'package:huixiang/mine/recharge_page.dart'; import 'package:huixiang/mine/user_info_page.dart'; @@ -75,8 +73,6 @@ import 'community/headlines/headlines_column_details.dart'; import 'home/guide_page.dart'; import 'home/home_view/activity_list.dart'; import 'main_page.dart'; -import 'mine/fans_page.dart'; -import 'mine/follow_page.dart'; import 'mine/manage_address_page.dart'; import 'mine/mine_view/community_follow.dart'; import 'mine/mine_vip/binding_assistant_card.dart'; @@ -84,7 +80,6 @@ import 'mine/mine_vip/legal_right_details.dart'; import 'mine/mine_vip/mine_attainment_page.dart'; import 'mine/mine_vip/mine_vip_core.dart'; import 'order/exchange_write_off_page.dart'; -import 'view_widget/vip_dialog.dart'; import 'mine/release_page.dart'; import 'mine/roll_center_page.dart'; @@ -143,7 +138,7 @@ initSdk() async { shareSDKRegister.setupFacebook( "523308712059457", "d3a1b6377100871799d8973fbe84794a", - "回乡", + "一心回乡", ); SharesdkPlugin.regist(shareSDKRegister); diff --git a/lib/mine/coupons_page.dart b/lib/mine/coupons_page.dart index 65a27988..a0f3bc1e 100644 --- a/lib/mine/coupons_page.dart +++ b/lib/mine/coupons_page.dart @@ -216,6 +216,7 @@ class _CouponsPage extends State { } } + ///选择店铺使用 showStoreSelector(storeList) { showModalBottomSheet( context: context, diff --git a/lib/retrofit/data/coupon.dart b/lib/retrofit/data/coupon.dart index 462c33a8..b8aef9eb 100644 --- a/lib/retrofit/data/coupon.dart +++ b/lib/retrofit/data/coupon.dart @@ -22,12 +22,14 @@ class Coupon { String promotionId; bool centreDisplay; String tenantCode; + String tenantName; int isDelete; String couponName; String couponImg; String couponDescription; String memberCouponId; String receiveTime; + String storeId; dynamic useTime; int status; List storeList; @@ -51,12 +53,14 @@ class Coupon { ..promotionId = json['promotionId'] as String ..centreDisplay = json['centreDisplay'] as bool ..tenantCode = json['tenantCode'] as String + ..tenantName = json['tenantName'] as String ..isDelete = json['isDelete'] as int ..couponName = json['couponName'] as String ..couponImg = json['couponImg'] as String ..couponDescription = json['couponDescription'] as String ..memberCouponId = json['memberCouponId'] as String ..receiveTime = json['receiveTime'] as String + ..storeId = json['storeId'] as String ..useTime = json['useTime'] ..status = json['status'] ..storeList = (json['storeList'] as List) @@ -81,12 +85,14 @@ class Coupon { 'promotionId': this.promotionId, 'centreDisplay': this.centreDisplay, 'tenantCode': this.tenantCode, + 'tenantName': this.tenantName, 'isDelete': this.isDelete, 'couponName': this.couponName, 'couponImg': this.couponImg, 'couponDescription': this.couponDescription, 'memberCouponId': this.memberCouponId, 'receiveTime': this.receiveTime, + 'storeId': this.storeId, 'useTime': this.useTime, 'status': this.status, 'storeList': (this.storeList != null && this.storeList.length > 0) ? this.storeList.map((e) => e.toJson()).toList() : [] diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index aac0a961..699cf918 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -53,11 +53,11 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index d1a64c02..1eb48e20 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.236:8766/app/'; } final Dio _dio; diff --git a/lib/setting/about_page.dart b/lib/setting/about_page.dart index d3e22b5a..bf3459be 100644 --- a/lib/setting/about_page.dart +++ b/lib/setting/about_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/bridge.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/update_dialog.dart'; import 'package:package_info/package_info.dart'; class AboutPage extends StatefulWidget { @@ -86,6 +87,7 @@ class _AboutPage extends State { onTap: () { Navigator.of(context) .pushNamed('/router/help_feedback_page'); + // showAlertDialog(version); }, child: textItem(S.of(context).shiyongbangzhu), ), @@ -265,4 +267,15 @@ class _AboutPage extends State { ), ); } + + ///app更新弹窗 + showAlertDialog(version) { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return UpdateDialog(version); + }, + ); + } } diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index 01adfceb..98a382c0 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -93,7 +93,8 @@ class NewCouponWidget extends StatelessWidget { ), Expanded( child: Text( - (coupon != null && coupon.storeList != null && coupon.storeList.length > 0) ? coupon.storeList[0].storeName ?? "" : "", + (coupon.storeId != "0" && coupon?.storeList != null && coupon.storeList.firstWhere((x) => x.id == coupon.storeId)!=null ? + coupon.storeList.firstWhere((x) => x.id == coupon.storeId).storeName : coupon.tenantName), overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 16.sp, diff --git a/lib/view_widget/update_dialog.dart b/lib/view_widget/update_dialog.dart new file mode 100644 index 00000000..3102e1b5 --- /dev/null +++ b/lib/view_widget/update_dialog.dart @@ -0,0 +1,136 @@ +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/utils/bridge.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:path_provider/path_provider.dart'; + +class UpdateDialog extends StatefulWidget { + final String version; + + UpdateDialog(this.version); + + @override + State createState() { + return _UpdateDialog(); + } +} + +class _UpdateDialog extends State { + @override + Widget build(BuildContext context) { + return Material( + type: MaterialType.transparency, + child: Center( + child: Container( + width: MediaQuery.of(context).size.width - 80.w, + height: 150.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: Column( + children: [ + Container( + width: double.infinity, + height: 90.h, + alignment: Alignment.center, + padding: EdgeInsets.all(20), + child: Column( + children: [ + Text( + "检测到新版本 v${widget.version}", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + Text( + "是否需要更新到最新版本?", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ) + ), + Container( + color: Color(0x1A000000), + height: 1.h, + ), + Container( + height: 55.h, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + width: double.infinity, + height: 90.h, + alignment: Alignment.center, + child: Text( + "下次再说", + style: TextStyle( + fontSize: 17.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + ), + ), + flex: 1, + ), + Container( + color: Color(0x1A000000), + width: 1.h, + ), + Expanded( + child: InkWell( + onTap: () { + Bridge.toAppStore().then((value) { + + }); + Navigator.of(context).pop(); + }, + child: Container( + width: double.infinity, + height: 90.h, + alignment: Alignment.center, + child: Text( + "立即更新", + style: TextStyle( + fontSize: 17.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ), + ), + flex: 1, + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + + Future _findLocalPath(BuildContext context) async { + final directory = Theme.of(context).platform == TargetPlatform.android + ? await getExternalStorageDirectory() + : await getApplicationDocumentsDirectory(); + return directory.path; + } + + +} diff --git a/pubspec.lock b/pubspec.lock index 5fde1375..784ca8a7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -77,7 +77,7 @@ packages: name: chewie url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.2" + version: "1.1.0" chewie_audio: dependency: "direct main" description: @@ -229,7 +229,7 @@ packages: name: flutter_html url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.5" + version: "2.2.0" flutter_layout_grid: dependency: transitive description: @@ -248,7 +248,7 @@ packages: name: flutter_math_fork url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.3+1" + version: "0.4.2+2" flutter_page_indicator: dependency: transitive description: @@ -269,7 +269,7 @@ packages: name: flutter_screenutil url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.0+2" + version: "5.0.1" flutter_smart_dialog: dependency: "direct main" description: @@ -398,7 +398,7 @@ packages: name: like_button url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.3" + version: "2.0.4" logger: dependency: "direct main" description: @@ -475,7 +475,7 @@ packages: name: path_provider_linux url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0" + version: "2.1.2" path_provider_platform_interface: dependency: transitive description: @@ -489,7 +489,7 @@ packages: name: path_provider_windows url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.3" + version: "2.0.4" pedantic: dependency: transitive description: @@ -531,7 +531,7 @@ packages: name: platform url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.2" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -552,7 +552,7 @@ packages: name: provider url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.0" + version: "6.0.1" pull_to_refresh: dependency: "direct main" description: @@ -622,7 +622,7 @@ packages: name: shared_preferences_linux url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.2" + version: "2.0.3" shared_preferences_macos: dependency: transitive description: @@ -650,14 +650,14 @@ packages: name: shared_preferences_windows url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.2" + version: "2.0.3" sharesdk_plugin: dependency: "direct main" description: name: sharesdk_plugin url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.3.2" sky_engine: dependency: transitive description: flutter