diff --git a/lib/kt_pages/kt_my_list/view.dart b/lib/kt_pages/kt_my_list/view.dart index 99c526a..bf25f9c 100644 --- a/lib/kt_pages/kt_my_list/view.dart +++ b/lib/kt_pages/kt_my_list/view.dart @@ -39,286 +39,288 @@ class _KtMyListPageState extends State { ), child: state.chestList.isEmpty && state.historyList.isEmpty ? KtStatusWidget( - type: KtErrorStatusType.nothingYet, - onPressed: logic.initData, - ) + type: KtErrorStatusType.nothingYet, + onPressed: logic.initData, + ) : SmartRefresher( - controller: logic.refreshCtrl, - enablePullUp: true, - enablePullDown: true, - onRefresh: () => logic.initData(), - onLoading: () => logic.getHistoryList(loadMore: true), - child: Column( - children: [ - if (state.chestList.isNotEmpty) - Container( - width: ScreenUtil().screenWidth - 30.w, - padding: EdgeInsets.fromLTRB(6.w, 53.w, 6.w, 6.w), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('collect_bg.png'.ktIcon), - fit: BoxFit.fill, - ), - ), - child: Column( - children: [ - Row( - children: [ - SizedBox(width: 6.w), - Text( - 'My Treasure Chest', - style: TextStyle( - fontSize: 18.sp, - color: Colors.white, - fontWeight: FontWeight.w800, - fontStyle: FontStyle.italic, - ), + controller: logic.refreshCtrl, + enablePullUp: true, + enablePullDown: true, + onRefresh: () => logic.initData(), + onLoading: () => logic.getHistoryList(loadMore: true), + child: Column( + children: [ + if (state.chestList.isNotEmpty) + Container( + width: ScreenUtil().screenWidth - 30.w, + padding: EdgeInsets.fromLTRB(6.w, 46.w, 6.w, 6.w), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('collect_bg.png'.ktIcon), + fit: BoxFit.fill, ), - const Spacer(), - GestureDetector( - onTap: () => Get.to(KtMyChestPage()), - child: Row( + ), + child: Column( + children: [ + Row( children: [ + SizedBox(width: 6.w), Text( - 'View All', + 'My Treasure Chest', style: TextStyle( - fontSize: 12.sp, - color: Color(0xFFD6D6D6), + fontSize: 18.sp, + color: Colors.white, + fontWeight: FontWeight.w800, + fontStyle: FontStyle.italic, ), ), - Image.asset( - 'ic_right_white.png'.ktIcon, - width: 10.w, + const Spacer(), + GestureDetector( + onTap: () => Get.to(KtMyChestPage()), + child: Container( + padding: EdgeInsets.all(8.w), + child: Row( + children: [ + Text( + 'View All', + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFD6D6D6), + ), + ), + Image.asset( + 'ic_right_white.png'.ktIcon, + width: 10.w, + ), + ], + ), + ), ), - SizedBox(width: 6.w), ], ), - ), - ], - ), - SizedBox(height: 15.w), - Container( - height: 145.w, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(14.w), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ...state.chestList.map( - (video) => Container( - margin: EdgeInsets.symmetric( - horizontal: 5.w, - ), - child: Stack( - children: [ - GestureDetector( - onTap: () => Get.toNamed( - KtRoutes.shortVideo, - arguments: { - 'shortPlayId': - video.shortPlayId, - 'imageUrl': - video.imageUrl ?? '', - }, + SizedBox(height: 8.w), + Container( + height: 145.w, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(14.w), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + ...state.chestList.map( + (video) => Container( + margin: EdgeInsets.symmetric( + horizontal: 5.w, ), - child: KtNetworkImage( - imageUrl: video.imageUrl ?? '', - width: 100.w, - height: 133.w, - borderRadius: - BorderRadius.circular(6.w), - ), - ), - Positioned( - right: 4.w, - top: 4.w, - child: GestureDetector( - onTap: () => - logic.cancelCollect( - video.shortPlayId!, + child: Stack( + children: [ + GestureDetector( + onTap: () => Get.toNamed( + KtRoutes.shortVideo, + arguments: { + 'shortPlayId': + video.shortPlayId, + 'imageUrl': + video.imageUrl ?? '', + }, ), - child: Image.asset( - 'ic_collect_sel.png'.ktIcon, - width: 28.w, - ), + child: KtNetworkImage( + imageUrl: video.imageUrl ?? '', + width: 100.w, + height: 133.w, + borderRadius: + BorderRadius.circular(6.w), + ), + ), + Positioned( + right: 4.w, + top: 4.w, + child: GestureDetector( + onTap: () => + logic.cancelCollect( + video.shortPlayId!, + ), + child: Image.asset( + 'ic_collect_sel.png'.ktIcon, + width: 28.w, + ), + ), + ), + ], ), ), - ], - ), + ), + ], ), ), ], ), ), - ], - ), - ), - SizedBox(height: 15.w), - Expanded( - child: Container( - width: ScreenUtil().screenWidth, - padding: EdgeInsets.all(15.w), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.vertical( - top: Radius.circular(20.w), - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Continue Watching', - style: TextStyle( - fontSize: 18.sp, - color: Color(0xFF1E1E20), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.italic, + SizedBox(height: 15.w), + Expanded( + child: Container( + width: ScreenUtil().screenWidth, + padding: EdgeInsets.all(15.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical( + top: Radius.circular(20.w), + ), ), - ), - Expanded( - child: ListView.separated( - padding: EdgeInsets.only(top: 10.w), - // shrinkWrap: true, - // physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - KtHistoryVideoBean video = - state.historyList[index]; - return GestureDetector( - onTap: () => Get.toNamed( - KtRoutes.shortVideo, - arguments: { - 'shortPlayId': video.shortPlayId, - 'imageUrl': video.imageUrl ?? '', - }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Continue Watching', + style: TextStyle( + fontSize: 18.sp, + color: Color(0xFF1E1E20), + fontWeight: FontWeight.w800, + fontStyle: FontStyle.italic, ), - child: Container( - color: Colors.transparent, - child: Row( - children: [ - KtNetworkImage( - imageUrl: video.imageUrl ?? '', - width: 74.w, - height: 98.w, - borderRadius: - BorderRadius.circular(8.w), + ), + Expanded( + child: ListView.separated( + padding: EdgeInsets.only(top: 10.w), + // shrinkWrap: true, + // physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + KtHistoryVideoBean video = + state.historyList[index]; + return GestureDetector( + onTap: () => Get.toNamed( + KtRoutes.shortVideo, + arguments: { + 'shortPlayId': video.shortPlayId, + 'imageUrl': video.imageUrl ?? '', + }, ), - SizedBox(width: 13.w), - SizedBox( - width: 200.w, - height: 98.w, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, + child: Container( + color: Colors.transparent, + child: Row( children: [ - Text( - video.name ?? '', - maxLines: 1, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13.sp, - color: Color(0xFF1E1E20), - fontWeight: - FontWeight.w500, - ), + KtNetworkImage( + imageUrl: video.imageUrl ?? '', + width: 74.w, + height: 98.w, + borderRadius: + BorderRadius.circular(8.w), ), - SizedBox(height: 6.w), - Text( - video.category?.first ?? '', - maxLines: 1, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF79C900), - fontWeight: - FontWeight.w400, - ), - ), - SizedBox(height: 20.w), - Row( - children: [ - SizedBox( - width: 26.w, - height: 26.w, - child: CircularProgressIndicator( - value: - (video.currentEpisode ?? - 0) / - (video.episodeTotal! > - 0 - ? video - .episodeTotal! - : 1), - backgroundColor: - Color(0xFFD9D9D9), - valueColor: - AlwaysStoppedAnimation< - Color - >( - Color( - 0xFFA7F62F, + SizedBox(width: 13.w), + SizedBox( + width: 200.w, + height: 98.w, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + video.name ?? '', + maxLines: 1, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13.sp, + color: Color(0xFF1E1E20), + fontWeight: + FontWeight.w500, + ), + ), + SizedBox(height: 6.w), + Text( + video.category?.first ?? '', + maxLines: 1, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF79C900), + fontWeight: + FontWeight.w400, + ), + ), + SizedBox(height: 20.w), + Row( + children: [ + SizedBox( + width: 26.w, + height: 26.w, + child: CircularProgressIndicator( + value: + (video.currentEpisode ?? + 0) / + (video.episodeTotal! > + 0 + ? video + .episodeTotal! + : 1), + backgroundColor: + Color(0xFFD9D9D9), + valueColor: + AlwaysStoppedAnimation< + Color + >( + Color( + 0xFFA7F62F, + ), + ), + strokeWidth: 3.w, + ), ), - ), - strokeWidth: 3.w, + SizedBox(width: 5.w), + Text( + "${((video.currentEpisode ?? 0) / (video.episodeTotal! > 0 ? video.episodeTotal! : 1) * 100).toStringAsFixed(0)}%", + style: TextStyle( + fontSize: 12.sp, + color: Color( + 0xFF1E1E20, + ), + fontWeight: + FontWeight.w400, + ), + ), + ], ), - ), - SizedBox(width: 5.w), - Text( - "${((video.currentEpisode ?? 0) / (video.episodeTotal! > 0 ? video.episodeTotal! : 1) * 100).toStringAsFixed(0)}%", - style: TextStyle( - fontSize: 12.sp, - color: Color( - 0xFF1E1E20, - ), - fontWeight: - FontWeight.w400, + ], + ), + ), + const Spacer(), + GestureDetector( + onTap: () => + logic.likeVideo(video), + child: Column( + children: [ + Image.asset( + video.isCollect == 1 + ? 'ic_collect_sel.png' + .ktIcon + : 'ic_collect_unsel.png' + .ktIcon, + width: 32.w, ), - ), - ], + ], + ), ), ], ), ), - const Spacer(), - GestureDetector( - onTap: () => - logic.likeVideo(video), - child: Column( - children: [ - Image.asset( - video.isCollect == 1 - ? 'ic_collect_sel.png' - .ktIcon - : 'ic_collect_unsel.png' - .ktIcon, - width: 32.w, - ), - ], - ), - ), - ], - ), + ); + }, + separatorBuilder: (_, __) => + SizedBox(height: 12.w), + itemCount: state.historyList.length, ), - ); - }, - separatorBuilder: (_, __) => - SizedBox(height: 12.w), - itemCount: state.historyList.length, + ), + ], ), ), - ], - ), + ), + ], ), ), - ], - ), - ), ); }, );