Pārlūkot izejas kodu

更新首页授权控件样式

tags/0.0.1
Weller pirms 4 gadiem
vecāks
revīzija
ae5d30c75b
12 mainītis faili ar 207 papildinājumiem un 132 dzēšanām
  1. +1
    -1
      .dart_tool/package_config.json
  2. +0
    -5
      .idea/codeStyles/codeStyleConfig.xml
  3. +13
    -0
      .idea/saveactions_settings.xml
  4. +44
    -33
      lib/pages/main_page/main_page.dart
  5. +1
    -0
      lib/pages/mine_page/mine_page.dart
  6. +46
    -29
      lib/register.dart
  7. +30
    -9
      lib/widgets/home/home_auth/home_auth.dart
  8. +0
    -21
      lib/widgets/home/home_auth/home_auth_creater.dart
  9. +0
    -26
      lib/widgets/home/home_auth/home_auth_delegate.dart
  10. +40
    -0
      lib/widgets/home/home_auth/models/home_auth_model.dart
  11. +32
    -0
      lib/widgets/home/home_auth/models/home_auth_model.g.dart
  12. +0
    -8
      lib/widgets/others/overlay/taobao_auth_overlay.dart

+ 1
- 1
.dart_tool/package_config.json Parādīt failu

@@ -770,7 +770,7 @@
"languageVersion": "2.1"
}
],
"generated": "2020-09-21T02:27:30.928433Z",
"generated": "2020-09-21T03:19:08.272955Z",
"generator": "pub",
"generatorVersion": "2.7.2"
}

+ 0
- 5
.idea/codeStyles/codeStyleConfig.xml Parādīt failu

@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

+ 13
- 0
.idea/saveactions_settings.xml Parādīt failu

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SaveActionSettings">
<option name="actions">
<set>
<option value="activate" />
<option value="organizeImports" />
<option value="reformat" />
</set>
</option>
<option name="configurationPath" value="" />
</component>
</project>

+ 44
- 33
lib/pages/main_page/main_page.dart Parādīt failu

@@ -8,6 +8,7 @@ import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.
import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth.dart';

class MainPage extends StatefulWidget {
final Map<String, dynamic> data;
@@ -24,9 +25,7 @@ class MainPage extends StatefulWidget {
class _MainPageState extends State<MainPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xfff9f9f9),
body: MultiProvider(
return MultiProvider(
providers: [
ChangeNotifierProvider.value(value: MainPageNotifier()),
ChangeNotifierProvider.value(value: MainPageBgNotifier()),
@@ -35,7 +34,7 @@ class _MainPageState extends State<MainPage> {
bloc: MainPageBloc(),
child: _MainPageContainer(widget.data),
),
),
);
}
}
@@ -56,6 +55,8 @@ class _MainPageContainerState extends State<_MainPageContainer> {
RefreshController _refreshController =
RefreshController(initialRefresh: false);

Widget _floatWidget;

void _onLoading() async {
// await Future.delayed(Duration(milliseconds: 1000));
// if (mounted) setState(() {});
@@ -93,35 +94,41 @@ class _MainPageContainerState extends State<_MainPageContainer> {

@override
Widget build(BuildContext context) {
return MediaQuery.removePadding(
removeTop: true,
context: context,
child: SmartRefresher(
enablePullDown: true,
enablePullUp: false,
header: WaterDropHeader(),
controller: _refreshController,
onLoading: _onLoading,
child: Container(
width: double.infinity,
child: StreamBuilder<List<Map<String, dynamic>>>(
stream: _bloc.outData,
builder: (BuildContext context, AsyncSnapshot snapshot) {
return Stack(
fit: StackFit.passthrough,
children: <Widget>[
MineHeaderBgWidget(
controller: _controller,
),
CustomScrollView(
controller: _controller,
slivers: _createContent(context, snapshot.data ?? []),
)
],
);
},
),
)),
return Scaffold(

backgroundColor: Color(0xfff9f9f9),
floatingActionButton: _floatWidget,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: MediaQuery.removePadding(
removeTop: true,
context: context,
child: SmartRefresher(
enablePullDown: true,
enablePullUp: false,
header: WaterDropHeader(),
controller: _refreshController,
onLoading: _onLoading,
child: Container(
width: double.infinity,
child: StreamBuilder<List<Map<String, dynamic>>>(
stream: _bloc.outData,
builder: (BuildContext context, AsyncSnapshot snapshot) {
return Stack(
fit: StackFit.passthrough,
children: <Widget>[
MineHeaderBgWidget(
controller: _controller,
),
CustomScrollView(
controller: _controller,
slivers: _createContent(context, snapshot.data ?? []),
)
],
);
},
),
)),
),
);
}

@@ -133,6 +140,10 @@ class _MainPageContainerState extends State<_MainPageContainer> {
WidgetModel.fromJson(Map<String, dynamic>.from(datas[i]));

print('item.modName ${item.modName}');
if (item.modName == 'index_taobao_auth_tip') {
_floatWidget = HomeAuth(datas[i]);
continue;
}
list.addAll(WidgetFactory.create(
item.modName,
isSliver: true,


+ 1
- 0
lib/pages/mine_page/mine_page.dart Parādīt failu

@@ -73,6 +73,7 @@ class _MinePageState extends State<MinePage> with TickerProviderStateMixin {
body: SafeArea(
child: NestedScrollView(
headerSliverBuilder: _silverBuilder,

body: TabBarView(
controller: _tabController,
children: <Widget>[


+ 46
- 29
lib/register.dart Parādīt failu

@@ -6,7 +6,6 @@ import 'package:zhiying_base_widget/pages/mine_detail_page/mine_detail_page.dart
import 'package:zhiying_base_widget/pages/orders_page/orders_page.dart';
import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart';
import 'package:zhiying_base_widget/pages/wallet_page/wallet_page.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth_creater.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart';
@@ -56,11 +55,11 @@ class BaseWidgetRegister {
// PageFactory.regist('login_account', (model) => LoginAccountPage(model));
// PageFactory.regist('login_invite', (model) => LoginInvitePage());

PageFactory.regist('pub.flutter.profile_settings', (model) => MineDetailPage());
PageFactory.regist(
'pub.flutter.profile_settings', (model) => MineDetailPage());
PageFactory.regist('pub.flutter.settings', (model) => SettingPage(model));

PageFactory.regist('pub.flutter.my_orders', (model) => OrdersPage(model));

}

// 注册控件
@@ -72,64 +71,82 @@ class BaseWidgetRegister {
// ==================== 首页
// WidgetFactory.regist('index_title', NormalNavCreater());
/// 首页搜索栏
// WidgetFactory.regist('index_search', HomeSreachCreater());
// WidgetFactory.regist('index_search', DefaultWidgetCreater((model) => HomeSreachWidget(model)));
// WidgetFactory.regist('index_search', HomeSreachCreater());
WidgetFactory.regist('index_search',
DefaultWidgetCreater((model) => HomeSreachWidget(model)));

/// 可滚动banner
WidgetFactory.regist('index_carousel', HomeSlideBannerCreater());
WidgetFactory.regist('index_recommend_list', GoodsListCreater());

/// 首页快速入口
WidgetFactory.regist('multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));
WidgetFactory.regist(
'multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));

/// 滚动公告
WidgetFactory.regist('index_placard', DefaultWidgetCreater((model) => HomeNoticeWidget(model)));
WidgetFactory.regist('index_placard',
DefaultWidgetCreater((model) => HomeNoticeWidget(model)));

/// 不可以滚动banner
WidgetFactory.regist('index_banner_one', HomeBannerCreater());
WidgetFactory.regist('index_banner_two', HomeBannerCreater());
WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());

/// ==================== 商品详情 ==================== ///
// 商品详情轮播图
WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
WidgetFactory.regist('product_detail_carousel',
DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
// 商品详情下载APP提示
WidgetFactory.regist('product_detail_download_tips', DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
WidgetFactory.regist('product_detail_download_tips',
DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
// 商品详情价格显示
WidgetFactory.regist('product_detail_price', DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
WidgetFactory.regist('product_detail_price',
DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
// 商品详情标题
WidgetFactory.regist('product_detail_title', DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
WidgetFactory.regist('product_detail_title',
DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
// 商品详情优惠劵
WidgetFactory.regist('product_detail_coupon', DefaultWidgetCreater((model) => CounponWidget(model)));
WidgetFactory.regist('product_detail_coupon',
DefaultWidgetCreater((model) => CounponWidget(model)));
// 商品详情店铺
WidgetFactory.regist('product_detail_shop', DefaultWidgetCreater((model) => StoreWidget(model)));
WidgetFactory.regist('product_detail_shop',
DefaultWidgetCreater((model) => StoreWidget(model)));
// 商品详情宝贝评价
WidgetFactory.regist('product_detail_comment', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
WidgetFactory.regist('product_detail_comment',
DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
// 商品详情图片
// WidgetFactory.regist('product_detail_img_list', MineNavCreater());
// 商品详情底部推荐列表
// WidgetFactory.regist('product_detail_bottom_rec', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
// 商品详情底部
WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));
WidgetFactory.regist('product_detail_bottom',
DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));

// ==================== 个人中心
WidgetFactory.regist('profile_appbar', MineNavCreater());
WidgetFactory.regist('profile_background', DefaultWidgetCreater((model) => MineNavBg(model)));
WidgetFactory.regist('profile_header', DefaultWidgetCreater((model) => MineHeader(model)));
WidgetFactory.regist('profile_earning', DefaultWidgetCreater((model) => MineData(model)));
WidgetFactory.regist('profile_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_my_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model)));
WidgetFactory.regist('profile_background',
DefaultWidgetCreater((model) => MineNavBg(model)));
WidgetFactory.regist(
'profile_header', DefaultWidgetCreater((model) => MineHeader(model)));
WidgetFactory.regist(
'profile_earning', DefaultWidgetCreater((model) => MineData(model)));
WidgetFactory.regist('profile_functions',
DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_my_functions',
DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_carousel',
DefaultWidgetCreater((model) => HomeBannerWidget(model)));

// ==================== 钱包
WidgetFactory.regist(
'wallet_data', DefaultWidgetCreater((model) => WalletData()));
// WidgetFactory.regist(
// 'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
WidgetFactory.regist('wallet_detail', HomeAuthCreater());
WidgetFactory.regist('wallet_data', DefaultWidgetCreater((model) => WalletData()));
WidgetFactory.regist('wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
WidgetFactory.regist(
'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
WidgetFactory.regist(
'wallet_data', DefaultWidgetCreater((model) => WalletData()));
WidgetFactory.regist(
'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));

WidgetFactory.regist('wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
WidgetFactory.regist(
'wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
}
}

+ 30
- 9
lib/widgets/home/home_auth/home_auth.dart Parādīt failu

@@ -1,10 +1,20 @@
import 'dart:convert' as convert;

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/models/home_auth_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class HomeAuth extends StatelessWidget {
final Map<String, dynamic> data;
Map<String, dynamic> _json;
HomeAuthModel _style;

const HomeAuth(this.data, {Key key}) : super(key: key);
HomeAuth(this.data, {Key key}) : super(key: key) {
String d = data['data'];
_json = convert.jsonDecode(d);
_style = HomeAuthModel.fromJson(Map<String, dynamic>.from(_json));
}

@override
Widget build(BuildContext context) {
@@ -13,12 +23,13 @@ class HomeAuth extends StatelessWidget {
width: double.infinity,
margin: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4),
decoration: BoxDecoration(
color: Colors.white,
color: HexColor.fromHex(_style?.bgColor ?? 'ffffff'),
borderRadius: BorderRadius.circular(17),
boxShadow: [
BoxShadow(
offset: Offset(2, 1), //x,y轴
color: Color(0x4d767676), //投影颜色
color: HexColor.fromHex(_style?.shadowColor ?? '767676')
.withAlpha(70), //投影颜色
blurRadius: 5 //投影距离
)
]),
@@ -28,13 +39,20 @@ class HomeAuth extends StatelessWidget {
margin: EdgeInsets.only(left: 10, right: 8),
width: 20,
height: 20,
color: Colors.redAccent,
child: CachedNetworkImage(
imageUrl: _style.icon,
fit: BoxFit.contain,
),
),
Expanded(
child: Text(
'一键授权淘宝权限,让购物更轻松',
_style?.text ?? '',
maxLines: 1,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: HexColor.fromHex(_style?.textColor ?? '333333'),
),
),
),
GestureDetector(
@@ -42,11 +60,14 @@ class HomeAuth extends StatelessWidget {
padding: EdgeInsets.only(left: 12, right: 12, top: 3, bottom: 3),
margin: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
color: Colors.redAccent,
color: HexColor.fromHex(_style?.tipBtnBgColor ?? 'FF4242'),
borderRadius: BorderRadius.circular(20)),
child: Text(
'点击授权',
style: TextStyle(fontSize: 12, color: Colors.white),
_style?.tipBtnText ?? '',
style: TextStyle(
fontSize: 12,
color: HexColor.fromHex(_style?.tipBtnTextColor ?? 'ffffff'),
),
),
),
onTap: () async {


+ 0
- 21
lib/widgets/home/home_auth/home_auth_creater.dart Parādīt failu

@@ -1,21 +0,0 @@
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth_delegate.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class HomeAuthCreater extends WidgetCreater {
@override
List<Widget> createWidgets(Map<String, dynamic> model) {
return [
SliverPersistentHeader(
pinned: true,
floating: false,
delegate: HomeAuthDelegate(model),
),
];
}

@override
bool isSliverChild() {
return true;
}
}

+ 0
- 26
lib/widgets/home/home_auth/home_auth_delegate.dart Parādīt failu

@@ -1,26 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth.dart';

class HomeAuthDelegate extends SliverPersistentHeaderDelegate {
final Map<String, dynamic> data;

HomeAuthDelegate(this.data);

@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
print('${shrinkOffset.toString()} ${overlapsContent.toString()}');
return HomeAuth(data);
}

@override
double get maxExtent => 40;

@override
double get minExtent => 40;

@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) =>
false; // 如果内容需要更新,设置为true
}

+ 40
- 0
lib/widgets/home/home_auth/models/home_auth_model.dart Parādīt failu

@@ -0,0 +1,40 @@
import 'package:json_annotation/json_annotation.dart';

part 'home_auth_model.g.dart';

@JsonSerializable()
class HomeAuthModel extends Object {

@JsonKey(name: 'taobao_auth_icon')
String icon;

@JsonKey(name: 'taoabo_tip_bg_color')
String bgColor;

@JsonKey(name: 'taoabo_tip_shadow_color')
String shadowColor;

@JsonKey(name: 'taoabo_tip_text_color')
String textColor;

@JsonKey(name: 'taoabo_tip_text')
String text;

@JsonKey(name: 'taoabo_tip_btn_text_color')
String tipBtnTextColor;

@JsonKey(name: 'taoabo_tip_btn_bg_color')
String tipBtnBgColor;

@JsonKey(name: 'taoabo_tip_btn_text')
String tipBtnText;

HomeAuthModel(this.icon,this.bgColor,this.shadowColor,this.textColor,this.text,this.tipBtnTextColor,this.tipBtnBgColor,this.tipBtnText,);

factory HomeAuthModel.fromJson(Map<String, dynamic> srcJson) => _$HomeAuthModelFromJson(srcJson);

Map<String, dynamic> toJson() => _$HomeAuthModelToJson(this);

}



+ 32
- 0
lib/widgets/home/home_auth/models/home_auth_model.g.dart Parādīt failu

@@ -0,0 +1,32 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'home_auth_model.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

HomeAuthModel _$HomeAuthModelFromJson(Map<String, dynamic> json) {
return HomeAuthModel(
json['taobao_auth_icon'] as String,
json['taoabo_tip_bg_color'] as String,
json['taoabo_tip_shadow_color'] as String,
json['taoabo_tip_text_color'] as String,
json['taoabo_tip_text'] as String,
json['taoabo_tip_btn_text_color'] as String,
json['taoabo_tip_btn_bg_color'] as String,
json['taoabo_tip_btn_text'] as String,
);
}

Map<String, dynamic> _$HomeAuthModelToJson(HomeAuthModel instance) =>
<String, dynamic>{
'taobao_auth_icon': instance.icon,
'taoabo_tip_bg_color': instance.bgColor,
'taoabo_tip_shadow_color': instance.shadowColor,
'taoabo_tip_text_color': instance.textColor,
'taoabo_tip_text': instance.text,
'taoabo_tip_btn_text_color': instance.tipBtnTextColor,
'taoabo_tip_btn_bg_color': instance.tipBtnBgColor,
'taoabo_tip_btn_text': instance.tipBtnText,
};

+ 0
- 8
lib/widgets/others/overlay/taobao_auth_overlay.dart Parādīt failu

@@ -1,8 +0,0 @@
import 'package:flutter/material.dart';

class TaobaoAuthOverlay extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}

Notiek ielāde…
Atcelt
Saglabāt