Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	lib/register.dart
tags/0.0.1
PH2 4 vuotta sitten
vanhempi
commit
29a547d826
23 muutettua tiedostoa jossa 671 lisäystä ja 132 poistoa
  1. BIN
     
  2. +0
    -1
      .dart_tool/build_resolvers/sdk.sum.deps
  3. +1
    -1
      .dart_tool/package_config.json
  4. +0
    -5
      .idea/codeStyles/codeStyleConfig.xml
  5. +13
    -0
      .idea/saveactions_settings.xml
  6. +44
    -33
      lib/pages/main_page/main_page.dart
  7. +1
    -0
      lib/pages/mine_page/mine_page.dart
  8. +35
    -13
      lib/pages/orders_page/orders_page.dart
  9. +199
    -0
      lib/pages/orders_page/views/order_filter.dart
  10. +15
    -6
      lib/pages/orders_page/views/order_tabbar_widget.dart
  11. +34
    -0
      lib/pages/setting_page/models/setting_page_style_item_model.dart
  12. +28
    -0
      lib/pages/setting_page/models/setting_page_style_item_model.g.dart
  13. +51
    -0
      lib/pages/setting_page/models/setting_page_style_model.dart
  14. +111
    -1
      lib/pages/setting_page/setting_page.dart
  15. +36
    -0
      lib/pages/setting_page/setting_page_bloc.dart
  16. +0
    -7
      lib/register.dart
  17. +30
    -9
      lib/widgets/home/home_auth/home_auth.dart
  18. +0
    -21
      lib/widgets/home/home_auth/home_auth_creater.dart
  19. +0
    -26
      lib/widgets/home/home_auth/home_auth_delegate.dart
  20. +40
    -0
      lib/widgets/home/home_auth/models/home_auth_model.dart
  21. +32
    -0
      lib/widgets/home/home_auth/models/home_auth_model.g.dart
  22. +1
    -1
      lib/widgets/mine/mine_nav/mine_nav.dart
  23. +0
    -8
      lib/widgets/others/overlay/taobao_auth_overlay.dart

+ 0
- 1
.dart_tool/build_resolvers/sdk.sum.deps Näytä tiedosto

@@ -1 +0,0 @@
{"sdk":"2.7.2 (Mon Mar 23 22:11:27 2020 +0100) on \"macos_x64\"","analyzer":"/Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.39.14","build_resolvers":"/Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/build_resolvers-1.3.11"}

+ 1
- 1
.dart_tool/package_config.json Näytä tiedosto

@@ -770,7 +770,7 @@
"languageVersion": "2.1"
}
],
"generated": "2020-09-21T02:27:30.928433Z",
"generated": "2020-09-22T07:54:03.242397Z",
"generator": "pub",
"generatorVersion": "2.7.2"
}

+ 0
- 5
.idea/codeStyles/codeStyleConfig.xml Näytä tiedosto

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

+ 13
- 0
.idea/saveactions_settings.xml Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

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

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


+ 35
- 13
lib/pages/orders_page/orders_page.dart Näytä tiedosto

@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_filter.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart';
import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.dart';
@@ -75,6 +76,10 @@ class _OrdersContainerState extends State<_OrdersContainer>
with TickerProviderStateMixin {
TabController _tabController;

GlobalKey _tabKey = GlobalKey();

bool _isFilterShow = false;

@override
void initState() {
_tabController = TabController(length: 6, vsync: this);
@@ -86,20 +91,37 @@ class _OrdersContainerState extends State<_OrdersContainer>
return Column(
children: <Widget>[
OrderSearchWidget(),
OrderTabbarWidget(_tabController, [
'全部',
'已付款',
'已结算',
'已失效',
'全部',
'已付款',
]),
OrderTabbarWidget(
_tabController,
[
'全部',
'已付款',
'已结算',
'已失效',
'全部',
'已付款',
],
key: _tabKey,
onMoreClick: () {
setState(() {
_isFilterShow = !_isFilterShow;
});
},
),
Expanded(
child: ListView.builder(
itemCount: 20,
itemBuilder: (context, index) {
return OrderItemWidget();
}),
child: Stack(
children: <Widget>[
ListView.builder(
itemCount: 20,
itemBuilder: (context, index) {
return OrderItemWidget();
}),
Visibility(
visible: _isFilterShow,
child: OrderFilterWidget(),
)
],
),
)
],
);


+ 199
- 0
lib/pages/orders_page/views/order_filter.dart Näytä tiedosto

@@ -0,0 +1,199 @@
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/others/action_date_alert/action_date_alert.dart';

class OrderFilterWidget extends StatefulWidget {
@override
_OrderFilterWidgetState createState() => _OrderFilterWidgetState();
}

class _OrderFilterWidgetState extends State<OrderFilterWidget> {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: double.infinity,
color: Color(0x55555555),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
_creteTitle('订单来源'),
_createTags(),
_creteTitle('订单类型'),
_createTags(),
_creteTitle('订单时间'),
_creteTime(),
Container(
width: double.infinity,
height: 0.5,
color: Color(0xffe3e3e3),
),
_createButtons(),
],
),
);
}

Widget _creteTitle(String title) {
return Container(
padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
width: double.infinity,
color: Colors.white,
child: Text(
title,
style: TextStyle(
color: Color(0xff333333),
fontSize: 14,
fontWeight: FontWeight.bold),
),
);
}

Widget _createTags() {
return Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 12.5, right: 12.5, bottom: 5, top: 5),
color: Colors.white,
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.start,
spacing: 20,
runSpacing: 10,
children: List.generate(10, (index) {
return Container(
padding: EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4),
decoration: BoxDecoration(
color: Colors.blue, borderRadius: BorderRadius.circular(5)),
child: Text(
'aaaa',
style: TextStyle(fontSize: 12),
),
);
}).toList(),
),
);
}

Widget _createButtons() {
return Container(
height: 54,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(12.5),
bottomRight: Radius.circular(12.5),
),
),
child: Row(
children: <Widget>[
Expanded(
child: Container(
color: Colors.transparent,
child: Center(
child: Text(
'重置',
style: TextStyle(fontSize: 15, color: Color(0xff999999)),
),
),
),
),
Container(
margin: EdgeInsets.only(top: 12, bottom: 12),
height: double.infinity,
width: 0.5,
color: Color(0xffe3e3e3),
),
Expanded(
child: Container(
color: Colors.transparent,
child: Center(
child: Text(
'确定',
style: TextStyle(fontSize: 15, color: Colors.redAccent),
),
),
),
),
],
),
);
}

Widget _creteTime() {
return Container(
color: Colors.white,
padding: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 20),
child: Row(
children: <Widget>[
GestureDetector(
child: Container(
width: 125,
height: 25,
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0xfff1f1f1),
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(
'2020-06',
style: TextStyle(
fontSize: 12,
color: Color(0xff999999),
),
),
),
),
onTap: () {
_selectDate();
},
),
Text(
'至',
style: TextStyle(
fontSize: 12,
color: Color(0xff999999),
),
),
GestureDetector(
child: Container(
width: 125,
height: 25,
margin: EdgeInsets.only(left: 10),
decoration: BoxDecoration(
color: Color(0xfff1f1f1),
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(
'2020-06',
style: TextStyle(
fontSize: 12,
color: Color(0xff999999),
),
),
),
),
onTap: () {
_selectDate();
},
),
],
),
);
}

void _selectDate() async {
DateTime dateTime = await showModalBottomSheet(
context: context,
builder: (context) {
return ActionDateAlert(
title: '选择起始日期',
);
},
isScrollControlled: false,
backgroundColor: Colors.transparent);
if (dateTime != null) {
String timeStamp =
(dateTime.millisecondsSinceEpoch / 1000).ceil().toString();
}
}
}

+ 15
- 6
lib/pages/orders_page/views/order_tabbar_widget.dart Näytä tiedosto

@@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
class OrderTabbarWidget extends StatelessWidget {
final TabController controller;
final List<String> titles;
final VoidCallback onMoreClick;

const OrderTabbarWidget(
this.controller,
this.titles, {
Key key,
this.onMoreClick,
}) : super(key: key);

@override
@@ -28,13 +30,20 @@ class OrderTabbarWidget extends StatelessWidget {
.toList(),
),
),
Container(
width: 40,
height: 40,
child: Icon(
Icons.filter_4,
size: 14,
GestureDetector(
child: Container(
width: 40,
height: 40,
child: Icon(
Icons.filter_4,
size: 14,
),
),
onTap: () {
if (onMoreClick != null) {
onMoreClick();
}
},
)
],
));


+ 34
- 0
lib/pages/setting_page/models/setting_page_style_item_model.dart Näytä tiedosto

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

part 'setting_page_style_item_model.g.dart';

@JsonSerializable()
class SettingPageStyleItemModel extends Object {
@JsonKey(name: 'name')
String name;

@JsonKey(name: 'name_color')
String nameColor;

@JsonKey(name: 'desc')
String desc;

@JsonKey(name: 'desc_color')
String descColor;

@JsonKey(name: 'skip_identifier')
String skipIdentifier;

SettingPageStyleItemModel(
this.name,
this.nameColor,
this.desc,
this.descColor,
this.skipIdentifier,
);

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

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

+ 28
- 0
lib/pages/setting_page/models/setting_page_style_item_model.g.dart Näytä tiedosto

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

part of 'setting_page_style_item_model.dart';

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

SettingPageStyleItemModel _$SettingPageStyleItemModelFromJson(
Map<String, dynamic> json) {
return SettingPageStyleItemModel(
json['name'] as String,
json['name_color'] as String,
json['desc'] as String,
json['desc_color'] as String,
json['skip_identifier'] as String,
);
}

Map<String, dynamic> _$SettingPageStyleItemModelToJson(
SettingPageStyleItemModel instance) =>
<String, dynamic>{
'name': instance.name,
'name_color': instance.nameColor,
'desc': instance.desc,
'desc_color': instance.descColor,
'skip_identifier': instance.skipIdentifier,
};

+ 51
- 0
lib/pages/setting_page/models/setting_page_style_model.dart Näytä tiedosto

@@ -0,0 +1,51 @@
import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_item_model.dart';

class SettingPageStyleModel extends Object {
String appBarName;
String appBarNameColor;
String appBarBgColor;
String logoutName;
String logoutNameColor;
String settingsBgColor;
List<List<SettingPageStyleItemModel>> settings;

SettingPageStyleModel(this.appBarName,
this.appBarNameColor,
this.appBarBgColor,
this.logoutName,
this.logoutNameColor,
this.settingsBgColor,
this.settings,);

factory SettingPageStyleModel.fromJson(Map<String, dynamic> json) {
var st = (json['settings'] as List).map((list) {
return (list as List)
?.map((item) =>
SettingPageStyleItemModel.fromJson(
Map<String, dynamic>.from(item)))
?.toList() ??
[];
})?.toList();
return SettingPageStyleModel(
json['app_bar_name'] as String,
json['app_bar_name_color'] as String,
json['app_bar_bg_color'] as String,
json['logout_name'] as String,
json['logout_name_color'] as String,
json['settings_bg_color'] as String,
st,
);
}

Map<String, dynamic> toJson() {
return <String, dynamic>{
'app_bar_name': this.appBarName,
'app_bar_name_color': this.appBarNameColor,
'app_bar_bg_color': this.appBarBgColor,
'logout_name': this.logoutName,
'logout_name_color': this.logoutNameColor,
'settings_bg_color': this.settingsBgColor,
'settings': this.settings,
};
}
}

+ 111
- 1
lib/pages/setting_page/setting_page.dart Näytä tiedosto

@@ -1,4 +1,10 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_item_model.dart';
import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_model.dart';
import 'package:zhiying_base_widget/pages/setting_page/setting_page_bloc.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class SettingPage extends StatefulWidget {
final Map<String, dynamic> data;
@@ -12,6 +18,110 @@ class SettingPage extends StatefulWidget {
class _SettingPageState extends State<SettingPage> {
@override
Widget build(BuildContext context) {
return Scaffold();
return BlocProvider<SettingPageBloc>(
bloc: SettingPageBloc(),
child: _SettingContainer(widget.data),
);
}
}

class _SettingContainer extends StatefulWidget {
final Map<String, dynamic> data;

const _SettingContainer(
this.data, {
Key key,
}) : super(key: key);

@override
_SettingContainerState createState() => _SettingContainerState();
}

class _SettingContainerState extends State<_SettingContainer> {
SettingPageBloc _bloc;

@override
void initState() {
_bloc = BlocProvider.of<SettingPageBloc>(context);
_bloc.loadData(widget.data['skip_identifier']);
super.initState();
}

@override
Widget build(BuildContext context) {
return StreamBuilder<SettingPageStyleModel>(
stream: _bloc.outData,
builder: (BuildContext context, AsyncSnapshot snapshot) {
SettingPageStyleModel style = snapshot.data;
return Scaffold(
backgroundColor: Color(0xfff9f9f9),
appBar: _createNav(style),
body: SingleChildScrollView(
child: Column(
children: style?.settings?.map((list) {
return _createSection(list);
})?.toList() ??
[],
),
));
});
}

// 导航栏
Widget _createNav(SettingPageStyleModel style) {
return CupertinoNavigationBar(
border: Border(
bottom: BorderSide(
width: 0.0, // One physical pixel.
style: BorderStyle.none,
),
),
backgroundColor: HexColor.fromHex(style?.appBarBgColor ?? 'ffffff'),
leading: Navigator.canPop(context)
? GestureDetector(
child: Container(
padding: EdgeInsets.zero,
child: Icon(
Icons.arrow_back_ios,
size: 20,
),
),
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
)
: Container(),
middle: Text(
style?.appBarName ?? '设置',
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex(style?.appBarNameColor ?? '333333'),
),
),
);
}

Widget _createSection(List<SettingPageStyleItemModel> sections) {
return Container(
margin: EdgeInsets.only(top: 8),
child: Column(
children: sections.map((item) {
return _createItem(item);
}).toList(),
),
);
}

Widget _createItem(SettingPageStyleItemModel item) {
return Container(
width: double.infinity,
height: 50,
color: Colors.white,
child: Row(
children: <Widget>[Text(item.name), Text('aaaaa')],
),
);
}
}

+ 36
- 0
lib/pages/setting_page/setting_page_bloc.dart Näytä tiedosto

@@ -0,0 +1,36 @@
import 'dart:async';
import 'dart:convert' as convert;

import 'package:zhiying_base_widget/pages/setting_page/models/setting_page_style_model.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class SettingPageBloc extends BlocBase {
SettingPageStyleModel _style;

StreamController<SettingPageStyleModel> _styleController =
StreamController<SettingPageStyleModel>();

Stream<SettingPageStyleModel> get outData => _styleController.stream;

@override
void dispose() {
_styleController.close();
_styleController = null;
}

void loadData(String skipIdentifier) async {
Api api = Api(
'/api/v1/mod/${skipIdentifier.toString()}', method: NetMethod.GET,);
_loadData(await api.onCache());
_loadData(await api.onRequest());
}

void _loadData(dynamic data) {
Map<String, dynamic> json = Map<String, dynamic>.from(data);
String d = json['data'];
Map<String, dynamic> da = Map<String, dynamic>.from(convert.jsonDecode(d));
_style = SettingPageStyleModel.fromJson(da);
_styleController.add(_style);
}
}

+ 0
- 7
lib/register.dart Näytä tiedosto

@@ -8,7 +8,6 @@ import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart';
import 'package:zhiying_base_widget/pages/sreach_page/sreach_page.dart';
import 'package:zhiying_base_widget/pages/sreach_result_page/sreach_result_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';
@@ -94,12 +93,6 @@ class BaseWidgetRegister {
WidgetFactory.regist('index_banner_two', HomeBannerCreater());
WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());

/// ==================== 搜索页 ==================== ///


/// ==================== 搜索结果页 ==================== ///


/// ==================== 商品详情 ==================== ///
// 商品详情轮播图
WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));


+ 30
- 9
lib/widgets/home/home_auth/home_auth.dart Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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,
};

+ 1
- 1
lib/widgets/mine/mine_nav/mine_nav.dart Näytä tiedosto

@@ -96,7 +96,7 @@ class MineNavIcon extends StatelessWidget {
),
onTap: () {
print('页面跳转 ${model.skipIdentifier}');
RouterUtil.route(data, context);
RouterUtil.route(model.toJson(), context);
},
);
}


+ 0
- 8
lib/widgets/others/overlay/taobao_auth_overlay.dart Näytä tiedosto

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

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

Ladataan…
Peruuta
Tallenna