diff --git a/assets/riv/finger_tapping.riv b/assets/riv/finger_tapping.riv new file mode 100644 index 00000000..7e6fcefd Binary files /dev/null and b/assets/riv/finger_tapping.riv differ diff --git a/assets/riv/runner_boy.riv b/assets/riv/runner_boy.riv new file mode 100644 index 00000000..9b3350a2 Binary files /dev/null and b/assets/riv/runner_boy.riv differ diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index fae84c68..40274ab5 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -344,7 +344,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { offset: Offset(0, 3), blurRadius: 14, spreadRadius: 0, - ) + ), ], ), child: Stack( diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index a0e7ebae..ab5f73ef 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -104,9 +104,7 @@ class _RechargePage extends State { ), ], color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(4), - ), + borderRadius: BorderRadius.circular(4), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, diff --git a/lib/union/store_details_page.dart b/lib/union/store_details_page.dart index 675bacbc..b3650959 100644 --- a/lib/union/store_details_page.dart +++ b/lib/union/store_details_page.dart @@ -393,7 +393,7 @@ class _StoreDetailsPage extends State fontSize: 12.sp, color: Colors.grey, ), - ) + ), ], ), ), @@ -461,7 +461,7 @@ class _StoreDetailsPage extends State offset: Offset(0, 2), blurRadius: 14, spreadRadius: 0, - ) + ), ], ), child: Column( @@ -474,8 +474,7 @@ class _StoreDetailsPage extends State child: Row( children: [ Text( - S - .of(context) + S.of(context) .pinglun_(commentTotal.toString()), style: TextStyle( fontSize: 16.sp, @@ -617,9 +616,8 @@ class _StoreDetailsPage extends State spreadRadius: 0, ), ], - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8.0), - topRight: Radius.circular(8.0), + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), ), ), child: Row( diff --git a/lib/union/union_details_page.dart b/lib/union/union_details_page.dart index 7fd6850d..2e6c2f3b 100644 --- a/lib/union/union_details_page.dart +++ b/lib/union/union_details_page.dart @@ -109,166 +109,159 @@ class _UnionDetailsPage extends State { children: [ AspectRatio( aspectRatio: 1, - child: GestureDetector( - onTap: () {}, - child: Container( - margin: EdgeInsets.fromLTRB(16, 20, 16, 8), - padding: EdgeInsets.fromLTRB(10, 20, 10, 14), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(8)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12, - spreadRadius: 0, - ) - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AspectRatio( - aspectRatio: 1.8, - child: buildSwiper(), - ), - Expanded( - child: Container( - margin: EdgeInsets.only( - left: 10.w, - right: 10.w, - top: 16.h, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - storeInfo != null - ? storeInfo.storeName - : "", - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.w500, - ), + child: Container( + margin: EdgeInsets.fromLTRB(16, 20, 16, 8), + padding: EdgeInsets.fromLTRB(10, 20, 10, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(8)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(25), + offset: Offset(0, 1), + blurRadius: 12, + spreadRadius: 0, + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 1.8, + child: buildSwiper(), + ), + Expanded( + child: Container( + margin: EdgeInsets.only( + left: 10.w, + right: 10.w, + top: 16.h, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + storeInfo != null + ? storeInfo.storeName + : "", + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.w500, ), - Expanded( - child: Container( - alignment: Alignment.centerRight, - child: Text( - S.of(context).ren( - storeInfo != null - ? storeInfo - .perCapitaConsumption - : "", - ), - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w400, - color: Color(0xFF353535), - ), + ), + Expanded( + child: Container( + alignment: Alignment.centerRight, + child: Text( + S.of(context).ren( + storeInfo != null + ? storeInfo + .perCapitaConsumption + : "", + ), + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w400, + color: Color(0xFF353535), ), ), - ) - ], - ), - Text( - storeInfo != null - ? storeInfo.address - : "", - maxLines: 2, - textAlign: TextAlign.justify, - style: TextStyle( - color: Color(0xFF353535), - fontWeight: FontWeight.w400, - fontSize: 12.sp, + ), ), + ], + ), + Text( + storeInfo != null + ? storeInfo.address + : "", + maxLines: 2, + textAlign: TextAlign.justify, + style: TextStyle( + color: Color(0xFF353535), + fontWeight: FontWeight.w400, + fontSize: 12.sp, ), - Row( - children: itemServer( - storeInfo != null - ? storeInfo.businessService - : "", - ), + ), + Row( + children: itemServer( + storeInfo != null + ? storeInfo.businessService : "", ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Expanded( - child: Text( - S.of(context).yingyeshijian(storeInfo == - null - ? "" - : (storeInfo.openStartTime == - null && - storeInfo.openEndTime == - null) - ? S.of(context).quantian - : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} - ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Expanded( + child: Text( + S.of(context).yingyeshijian(storeInfo == null + ? "" : (storeInfo.openStartTime == null && storeInfo.openEndTime == null) + ? S.of(context).quantian + : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} " + "- ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), style: TextStyle( color: Color(0xFF353535), fontWeight: FontWeight.w400, fontSize: 12.sp, ), - )), - SizedBox( - width: 16.w, ), - InkWell( - onTap: () { - if (storeInfo == null || - storeInfo.latitude == null || - storeInfo.longitude == null || - storeInfo.latitude == "" || - storeInfo.longitude == "") - return; - Navigator.of(context).pushNamed( - '/router/location_map', - arguments: { - "lat": storeInfo.latitude, - "lng": storeInfo.longitude, - "storeName": - storeInfo.storeName, - }); - }, - child: Image.asset( - "assets/image/icon_union_location.png", - width: 24.w, - height: 24.h, - ), - ), - SizedBox( - width: 16.w, + ), + SizedBox( + width: 16.w, + ), + InkWell( + onTap: () { + if (storeInfo == null || + storeInfo.latitude == null || + storeInfo.longitude == null || + storeInfo.latitude == "" || + storeInfo.longitude == "") + return; + Navigator.of(context).pushNamed( + '/router/location_map', + arguments: { + "lat": storeInfo.latitude, + "lng": storeInfo.longitude, + "storeName": + storeInfo.storeName, + }); + }, + child: Image.asset( + "assets/image/icon_union_location.png", + width: 24.w, + height: 24.h, ), - InkWell( - onTap: () { - showCallMobile(); - }, - child: Image.asset( - "assets/image/icon_union_call.png", - width: 24, - height: 24, - ), + ), + SizedBox( + width: 16.w, + ), + InkWell( + onTap: () { + showCallMobile(); + }, + child: Image.asset( + "assets/image/icon_union_call.png", + width: 24, + height: 24, ), - ], - ), - ], - ), + ), + ], + ), + ], ), - flex: 1, ), - ], - ), + flex: 1, + ), + ], ), ), ), @@ -336,9 +329,8 @@ class _UnionDetailsPage extends State { padding: EdgeInsets.only(top: 16.h, bottom: 16.h), decoration: BoxDecoration( color: isEnable() ? Color(0xFF32A060) : Color(0xFFD8D8D8), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(4), - topRight: Radius.circular(4), + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), ), ), alignment: Alignment.center, @@ -649,8 +641,6 @@ class _UnionDetailsPage extends State { .couponVOList[position] .discountPercent)) : "", - // (storeInfo != null && storeInfo.couponVOList != null) ? storeInfo.couponVOList[position].couponImg : "", - // S.of(context).manlijiandaijinquan(30, 5), overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 12.sp, @@ -661,9 +651,12 @@ class _UnionDetailsPage extends State { Text( S.of(context).youxiaoqizhi( (storeInfo != null && - storeInfo.couponVOList != null && + storeInfo.couponVOList != + null && // storeInfo.couponVOList[position].useStartTime != null && - storeInfo.couponVOList[position].useEndTime != null) + storeInfo.couponVOList[position] + .useEndTime != + null) // ? "${storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" ? "${storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" : "", @@ -704,14 +697,15 @@ class _UnionDetailsPage extends State { 0) ? Colors.grey : Color(0xFF32A060), - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + padding: EdgeInsets.symmetric( + horizontal: 8.w, vertical: 4.h), fontSize: 12.sp, ), ), ), ], ), - ) + ), ], ), ), diff --git a/lib/view_widget/classic_header.dart b/lib/view_widget/classic_header.dart index 4c58745b..2dafad97 100644 --- a/lib/view_widget/classic_header.dart +++ b/lib/view_widget/classic_header.dart @@ -1,14 +1,21 @@ +import 'package:flare_flutter/flare_actor.dart'; +import 'package:flare_flutter/flare_controller.dart'; +import 'package:flare_flutter/flare_controls.dart'; +import 'package:flare_flutter/provider/asset_flare.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart' hide RefreshIndicator, RefreshIndicatorState; +import 'package:flutter/services.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/rotate_container.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:rive/rive.dart'; class MyHeader extends StatelessWidget { @override Widget build(BuildContext context) { + // return CustomHeader(); return MyClassicHeader( completeIcon: const Icon(Icons.done, color: Color(0xFF32A060)), completeText: S.of(context).shuaxinchenggong, @@ -29,6 +36,62 @@ class MyHeader extends StatelessWidget { } } +class CustomHeader extends RefreshIndicator { + @override + State createState() { + return _CustomHeader(); + } +} + +class _CustomHeader extends RefreshIndicatorState { + + FlareControls flareController = FlareControls(); + + Artboard _riveArtboard; + RiveAnimationController _controllerIdle; + + + + @override + void initState() { + super.initState(); + + // rootBundle.load("assets/riv/finger_tapping.riv").then((value) async { + rootBundle.load("assets/riv/runner_boy.riv").then((value) async { + final riveFile = RiveFile(); + riveFile.import(value); + final artboard = riveFile.mainArtboard; + artboard.addController(_controllerIdle = SimpleAnimation("Animation")); + // artboard.addController(_controllerIdle = SimpleAnimation("Idle_1")); + + setState(() { + _riveArtboard = artboard; + }); + }); + } + + @override + Widget buildContent(BuildContext context, RefreshStatus mode) { + + if (_controllerIdle != null) { + if (mode == RefreshStatus.idle) { + _controllerIdle.isActive = false; + } else { + _controllerIdle.isActive = true; + } + } + + return Container( + height: 50, + child: Rive( + artboard: _riveArtboard, + alignment: Alignment.center, + fit: BoxFit.contain, + ), + ); + } +} + class MyClassicHeader extends RefreshIndicator { final OuterBuilder outerBuilder; final String releaseText, diff --git a/lib/view_widget/hot_item.dart b/lib/view_widget/hot_item.dart index 02222831..bafe1b8b 100644 --- a/lib/view_widget/hot_item.dart +++ b/lib/view_widget/hot_item.dart @@ -46,7 +46,7 @@ class _HotArticleItem extends State { color: Colors.white, boxShadow: [ BoxShadow( - color: Colors.green.withAlpha(12), + color: Colors.grey.withAlpha(12), offset: Offset(0, 3), blurRadius: 14, spreadRadius: 0, @@ -270,7 +270,7 @@ class _HotArticleItem extends State { child: MImage( widget.article != null ? widget.article.coverImg : "", fit: BoxFit.cover, - radius: BorderRadius.circular(4), + radius: BorderRadius.vertical(top: Radius.circular(4)), width: MediaQuery.of(context).size.width - 32.w, height: 150.h, ), diff --git a/pubspec.lock b/pubspec.lock index 6613930b..d9f7cdb3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -274,6 +274,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.10.11" + flare_flutter: + dependency: "direct main" + description: + name: flare_flutter + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.2" flutter: dependency: "direct main" description: flutter @@ -749,6 +756,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.4.1+3" + rive: + dependency: "direct main" + description: + name: rive + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.8" rxdart: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 1c3e371f..6741f350 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -86,6 +86,9 @@ dependencies: sharesdk_plugin: ^1.3.0 + rive: ^0.6.8 + flare_flutter: ^3.0.2 + dev_dependencies: flutter_test: sdk: flutter @@ -101,6 +104,7 @@ flutter: assets: - assets/image/ - assets/map_style/ + - assets/riv/ flutter_intl: enabled: true