Browse Source

修复了启动太快的bug

tags/0.0.1
Weller 4 years ago
parent
commit
28e47f4fa5
36 changed files with 101 additions and 45 deletions
  1. +1
    -1
      .dart_tool/package_config.json
  2. BIN
     
  3. +6
    -6
      example/ios/Runner/项目资源/智莺生活/image/智莺生活.xcassets/AppIcon.appiconset/Contents.json
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. BIN
     
  13. BIN
     
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. BIN
     
  20. BIN
     
  21. BIN
     
  22. BIN
     
  23. BIN
     
  24. BIN
     
  25. BIN
     
  26. BIN
     
  27. BIN
     
  28. BIN
     
  29. BIN
     
  30. BIN
     
  31. BIN
     
  32. BIN
     
  33. +12
    -7
      lib/pages/goods_details_page/goods_details_page.dart
  34. +1
    -0
      lib/pages/launch_page/launch_page.dart
  35. +5
    -3
      lib/register.dart
  36. +76
    -28
      lib/widgets/home/home_slide_banner/home_slide_banner.dart

+ 1
- 1
.dart_tool/package_config.json View File

@@ -614,7 +614,7 @@
"languageVersion": "2.1" "languageVersion": "2.1"
} }
], ],
"generated": "2020-09-30T08:56:02.620599Z",
"generated": "2020-09-30T09:06:30.237124Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.7.2" "generatorVersion": "2.7.2"
} }

BIN
View File


+ 6
- 6
example/ios/Runner/项目资源/智莺生活/image/智莺生活.xcassets/AppIcon.appiconset/Contents.json View File

@@ -33,7 +33,7 @@
{ {
"size" : "40x40", "size" : "40x40",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "icon-40@2x.png",
"filename" : "icon-40@2x-1.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
@@ -57,25 +57,25 @@
{ {
"size" : "20x20", "size" : "20x20",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "icon-20-ipad.png",
"filename" : "icon-20.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"size" : "20x20", "size" : "20x20",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "icon-20@2x-ipad.png",
"filename" : "icon-20@2x-1.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"size" : "29x29", "size" : "29x29",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "icon-29-ipad.png",
"filename" : "icon-30.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"size" : "29x29", "size" : "29x29",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "icon-29@2x-ipad.png",
"filename" : "icon-29@2x-1.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
@@ -111,7 +111,7 @@
{ {
"size" : "1024x1024", "size" : "1024x1024",
"idiom" : "ios-marketing", "idiom" : "ios-marketing",
"filename" : "icon-1024.png",
"filename" : "iTunesArtwork@2x.png",
"scale" : "1x" "scale" : "1x"
} }
], ],


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 12
- 7
lib/pages/goods_details_page/goods_details_page.dart View File

@@ -56,7 +56,8 @@ class GoodsDetailsContainer extends StatefulWidget {
class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {
bool _isEnded = false; bool _isEnded = false;
ScrollController _controller = ScrollController(); ScrollController _controller = ScrollController();
RefreshController _refreshController = RefreshController(initialRefresh: false);
RefreshController _refreshController =
RefreshController(initialRefresh: false);


void _onLoading() async { void _onLoading() async {
// await Future.delayed(Duration(milliseconds: 1000)); // await Future.delayed(Duration(milliseconds: 1000));
@@ -133,12 +134,16 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Container( body: Container(
color: Color(0xfff1f1f1),
child: CustomScrollView(
controller: _controller,
slivers: _createContent(context, datas ?? []),
),
),
color: Color(0xfff1f1f1),
child: Stack(
children: <Widget>[
CustomScrollView(
controller: _controller,
slivers: _createContent(context, datas ?? []),
),
_getAppBarWidget(),
],
)),


/// appBar /// appBar
// Align(alignment: Alignment.topCenter, child: _getAppBarWidget()), // Align(alignment: Alignment.topCenter, child: _getAppBarWidget()),


+ 1
- 0
lib/pages/launch_page/launch_page.dart View File

@@ -48,6 +48,7 @@ class _LaunchPageState extends State<LaunchPage> {
return Image.asset( return Image.asset(
'assets/images/launch_image/launch_image.png', 'assets/images/launch_image/launch_image.png',
package: 'zhiying_base_widget', package: 'zhiying_base_widget',
fit: BoxFit.cover,
); );
} }
} }

+ 5
- 3
lib/register.dart View File

@@ -22,7 +22,6 @@ import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_det
import 'package:zhiying_base_widget/widgets/goods_details/store/store_widget.dart'; import 'package:zhiying_base_widget/widgets/goods_details/store/store_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart'; import 'package:zhiying_base_widget/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_notice/home_notice_widget.dart'; import 'package:zhiying_base_widget/widgets/home/home_notice/home_notice_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.dart';
@@ -84,6 +83,10 @@ class BaseWidgetRegister {
register.setupQQ("1111030588", "XoHKlrBybXy7ORBt"); register.setupQQ("1111030588", "XoHKlrBybXy7ORBt");
SharesdkPlugin.regist(register); SharesdkPlugin.regist(register);
}); });

Application.addMethod(() async {
return Future.delayed(Duration(seconds: 2));
});
} }


// 注册页面 // 注册页面
@@ -269,8 +272,7 @@ class BaseWidgetRegister {
WidgetFactory.regist('profile_my_functions', WidgetFactory.regist('profile_my_functions',
DefaultWidgetCreater((model) => MineQuickEntry(model))); DefaultWidgetCreater((model) => MineQuickEntry(model)));
// WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model))); // WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model)));
WidgetFactory.regist('profile_carousel',
DefaultWidgetCreater((model) => HomeBannerWidget(model)));
// WidgetFactory.regist('profile_carousel', HomeBannerCreater());


// ==================== 钱包 // ==================== 钱包
WidgetFactory.regist( WidgetFactory.regist(


+ 76
- 28
lib/widgets/home/home_slide_banner/home_slide_banner.dart View File

@@ -1,10 +1,9 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart'; import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/zhiying_comm.dart';


import 'bloc/bloc.dart'; import 'bloc/bloc.dart';
@@ -28,7 +27,9 @@ class _HomeSlideBannerState extends State<HomeSlideBanner> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocProvider<HomeSlideBannerBloc>( return BlocProvider<HomeSlideBannerBloc>(
create: (_) => HomeSlideBannerBloc(repository: HomeSlideBannerRepository())..add(HomeBannerInitEvent(model: widget?.model)),
create: (_) =>
HomeSlideBannerBloc(repository: HomeSlideBannerRepository())
..add(HomeBannerInitEvent(model: widget?.model)),
child: HomeSlideBannerContainer(), child: HomeSlideBannerContainer(),
); );
} }
@@ -36,11 +37,11 @@ class _HomeSlideBannerState extends State<HomeSlideBanner> {


class HomeSlideBannerContainer extends StatefulWidget { class HomeSlideBannerContainer extends StatefulWidget {
@override @override
_HomeSlideBannerContainerState createState() => _HomeSlideBannerContainerState();
_HomeSlideBannerContainerState createState() =>
_HomeSlideBannerContainerState();
} }


class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> { class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {

/// 子元素点击事件 /// 子元素点击事件
void _itemOnClick(IndexCarousel model) { void _itemOnClick(IndexCarousel model) {
print('点击了 $model'); print('点击了 $model');
@@ -80,7 +81,17 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
} }


Widget _getMainWidget(HomeSlideBannerModel datas) { Widget _getMainWidget(HomeSlideBannerModel datas) {
Future.delayed(Duration.zero, () {
Provider.of<MainPageBgNotifier>(context, listen: false)
.switchBg(Container(
width: double.infinity,
height: 200,
color: Colors.redAccent,
));
});

return Container( return Container(
margin: EdgeInsets.all(10),
width: double.infinity, width: double.infinity,
height: 140, height: 140,
child: Swiper( child: Swiper(
@@ -98,13 +109,15 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
loop: true, loop: true,
autoplay: true, autoplay: true,
onTap: (index) => _itemOnClick(datas.index_carousel_list[index]), onTap: (index) => _itemOnClick(datas.index_carousel_list[index]),
pagination: _getSwiperStyleByType(datas, datas?.index_carousel_list?.length ?? 0),
pagination: _getSwiperStyleByType(
datas, datas?.index_carousel_list?.length ?? 0),
onIndexChanged: (index) { onIndexChanged: (index) {
//print('切换下一页'); //print('切换下一页');
Provider.of<MainPageBgNotifier>(context, listen: false).switchBg(Container(
Provider.of<MainPageBgNotifier>(context, listen: false)
.switchBg(Container(
width: double.infinity, width: double.infinity,
height: 200, height: 200,
color: Colors.primaries[(index + 2) % Colors.primaries.length],
color: Colors.redAccent,
)); ));
}, },
), ),
@@ -112,50 +125,71 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
} }


/// 获取进度样式 /// 获取进度样式
SwiperPlugin _getSwiperStyleByType(HomeSlideBannerModel model, int pageCount) {
if('1' != model.pagination_open){
SwiperPlugin _getSwiperStyleByType(
HomeSlideBannerModel model, int pageCount) {
if ('1' != model.pagination_open) {
return null; return null;
} }


if ('type_number' == model.pagination) { if ('type_number' == model.pagination) {
return _getNumswiperPlugin(pageCount, model.pagination_select_color, model.pagination_unselect_color);
return _getNumswiperPlugin(pageCount, model.pagination_select_color,
model.pagination_unselect_color);
} }
if ('type_point' == model.pagination) { if ('type_point' == model.pagination) {
return _swiperCustomPaginationDito(pageCount, model.pagination_select_color, model.pagination_unselect_color);
return _swiperCustomPaginationDito(pageCount,
model.pagination_select_color, model.pagination_unselect_color);
} }
if ('type_bar' == model.pagination) { if ('type_bar' == model.pagination) {
return _swiperCustomPagination(pageCount, model.pagination_select_color, model.pagination_unselect_color);
return _swiperCustomPagination(pageCount, model.pagination_select_color,
model.pagination_unselect_color);
} }
return null; return null;
} }


/// 数字样式 /// 数字样式
SwiperPlugin _getNumswiperPlugin(int pageCount, String selectColor, String unselectColor) {
return SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
SwiperPlugin _getNumswiperPlugin(
int pageCount, String selectColor, String unselectColor) {
return SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
return Align( return Align(
alignment: Alignment(0.0, 0.9), alignment: Alignment(0.0, 0.9),
child: Container( child: Container(
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 18), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 18),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(13), color: HexColor.fromHex('#4D000000')),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(13),
color: HexColor.fromHex('#4D000000')),
child: RichText( child: RichText(
text: TextSpan(text: '${config.activeIndex + 1}', style: TextStyle(fontSize: 12, color: HexColor.fromHex(selectColor)), children: [
TextSpan(text: '/', style: TextStyle(fontSize: 12, color: HexColor.fromHex(unselectColor))),
TextSpan(text: '$pageCount', style: TextStyle(fontSize: 12, color: HexColor.fromHex(unselectColor))),
]),
text: TextSpan(
text: '${config.activeIndex + 1}',
style: TextStyle(
fontSize: 12, color: HexColor.fromHex(selectColor)),
children: [
TextSpan(
text: '/',
style: TextStyle(
fontSize: 12,
color: HexColor.fromHex(unselectColor))),
TextSpan(
text: '$pageCount',
style: TextStyle(
fontSize: 12,
color: HexColor.fromHex(unselectColor))),
]),
)), )),
); );
}); });
} }


/// 自定义进度条 /// 自定义进度条
SwiperPlugin _swiperCustomPagination(int pageCount, String selectColor, String unselectColor) {
SwiperPlugin _swiperCustomPagination(
int pageCount, String selectColor, String unselectColor) {
List list = []; List list = [];
for (int i = 0; i < pageCount; i++) { for (int i = 0; i < pageCount; i++) {
list.add(i); list.add(i);
} }


return SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
return SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
return Align( return Align(
alignment: Alignment(0.0, 0.9), alignment: Alignment(0.0, 0.9),
child: Row( child: Row(
@@ -164,10 +198,13 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
children: list.map((index) { children: list.map((index) {
var borderRadius; var borderRadius;
if (index == 0) { if (index == 0) {
borderRadius = BorderRadius.only(topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
borderRadius = BorderRadius.only(
topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
} }
if (index == list.length - 1) { if (index == list.length - 1) {
borderRadius = BorderRadius.only(topRight: Radius.circular(2), bottomRight: Radius.circular(2));
borderRadius = BorderRadius.only(
topRight: Radius.circular(2),
bottomRight: Radius.circular(2));
} }


if (index == config.activeIndex) { if (index == config.activeIndex) {
@@ -177,7 +214,11 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
return Container( return Container(
height: 4, height: 4,
width: 25, width: 25,
decoration: BoxDecoration(borderRadius: borderRadius, color: index == config.activeIndex ? HexColor.fromHex(selectColor) : HexColor.fromHex(unselectColor)),
decoration: BoxDecoration(
borderRadius: borderRadius,
color: index == config.activeIndex
? HexColor.fromHex(selectColor)
: HexColor.fromHex(unselectColor)),
); );
}).toList(), }).toList(),
), ),
@@ -186,7 +227,14 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> {
} }


/// 圆形进度条 /// 圆形进度条
SwiperPlugin _swiperCustomPaginationDito(int pageCount, String selectColor, String unselectColor) {
return SwiperPagination(margin: const EdgeInsets.only(), builder: DotSwiperPaginationBuilder( color: HexColor.fromHex(unselectColor), activeColor: HexColor.fromHex(selectColor), size: 8, activeSize: 8));
SwiperPlugin _swiperCustomPaginationDito(
int pageCount, String selectColor, String unselectColor) {
return SwiperPagination(
margin: const EdgeInsets.only(),
builder: DotSwiperPaginationBuilder(
color: HexColor.fromHex(unselectColor),
activeColor: HexColor.fromHex(selectColor),
size: 8,
activeSize: 8));
} }
} }

Loading…
Cancel
Save