Procházet zdrojové kódy

添加钱包

tags/0.0.1
Weller před 4 roky
rodič
revize
8b79fd5556
9 změnil soubory, kde provedl 278 přidání a 69 odebrání
  1. +54
    -0
      lib/pages/wallet_page/wallet_detail_list_page.dart
  2. +106
    -0
      lib/pages/wallet_page/wallet_detail_page.dart
  3. +3
    -16
      lib/pages/wallet_page/wallet_page.dart
  4. +8
    -0
      lib/pages/wallet_page/widgets/wallet_tab_widget.dart
  5. +7
    -6
      lib/register.dart
  6. +37
    -14
      lib/widgets/others/normal_nav/normal_nav.dart
  7. +1
    -1
      lib/widgets/others/normal_nav/normal_nav_creater.dart
  8. +41
    -27
      lib/widgets/wallet/wallet_bil/wallet_bil.dart
  9. +21
    -5
      lib/widgets/wallet/wallet_data/wallet_data.dart

+ 54
- 0
lib/pages/wallet_page/wallet_detail_list_page.dart Zobrazit soubor

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

class WalletDetailListPage extends StatefulWidget {
@override
_WalletDetailListPageState createState() => _WalletDetailListPageState();
}

class _WalletDetailListPageState extends State<WalletDetailListPage> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5),
child: Column(
children: <Widget>[
_createHeader(),
_createContent(),
],
),
);
}

Widget _createHeader() {
return Container(
height: 50,
child: Row(
children: <Widget>[
Container(
width: 80,
child: Row(
children: <Widget>[
Text(
'2020-10',
style: TextStyle(
fontSize: 14,
color: Color(0xff333333),
fontWeight: FontWeight.bold,
),
),
],
),
),
Expanded(
child: SingleChildScrollView(
child: Row(),
))
],
),
);
}

Widget _createContent() {
return Container();
}
}

+ 106
- 0
lib/pages/wallet_page/wallet_detail_page.dart Zobrazit soubor

@@ -0,0 +1,106 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import 'package:zhiying_base_widget/pages/wallet_page/wallet_detail_list_page.dart';
import 'package:zhiying_comm/util/extension/color.dart';

class WalletDetailPage extends StatefulWidget {
@override
_WalletDetailPageState createState() => _WalletDetailPageState();
}

class _WalletDetailPageState extends State<WalletDetailPage>
with TickerProviderStateMixin {
TabController _controller;

@override
void initState() {
_controller = TabController(vsync: this, length: 2);
super.initState();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _createNav(),
body: SafeArea(
child: Column(
children: <Widget>[
_createTab(),
Expanded(
child: _createContent(),
),
],
),
),
);
}

// 导航栏
Widget _createNav() {
return CupertinoNavigationBar(
border: Border(
bottom: BorderSide(
width: 0.0, // One physical pixel.
style: BorderStyle.none,
),
),
backgroundColor: Colors.white,
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: TextStyle(
fontSize: 15,
color: Color(0xff333333),
),
),
);
}

Widget _createTab() {
return Container(
color: Colors.white,
child: TabBar(
isScrollable: false,
labelStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 13),
unselectedLabelStyle: TextStyle(fontSize: 13),
indicator: MaterialIndicator(
height: 2,
topLeftRadius: 8,
topRightRadius: 8,
bottomLeftRadius: 8,
bottomRightRadius: 8,
color: HexColor.fromHex('#F94B47'),
horizontalPadding: 30,
),
controller: _controller,
tabs: List.generate(2, (index) => Tab(text: '收入明细')),
indicatorColor: Colors.red,
unselectedLabelColor: HexColor.fromHex('#999999'),
labelColor: HexColor.fromHex('#000000'),
),
);
}

Widget _createContent() {
return TabBarView(
controller: _controller,
children: <Widget>[WalletDetailListPage(), Container()],
);
}
}

+ 3
- 16
lib/pages/wallet_page/wallet_page.dart Zobrazit soubor

@@ -5,15 +5,13 @@ import 'package:pull_to_refresh/pull_to_refresh.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_notifier.dart';
import 'package:zhiying_base_widget/utils/contants.dart';
import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_appbar/wallet_appbar_sk.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data_sk.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_sk.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_income/wallet_income_sk.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/util/custom_sliver_persistent_header_delegate.dart';
import 'wallet_page_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'wallet_page_bloc.dart';

///钱包页面
@@ -82,7 +80,7 @@ class _WalletPageContainerState extends State<_WalletPageContainer> {
return SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp:true,
enablePullUp: true,
header: WaterDropHeader(),
onLoading: _onLoading,
child: Container(
@@ -131,17 +129,6 @@ class _WalletPageContainerState extends State<_WalletPageContainer> {
for (var item in model) {
WidgetModel widgetModel =
WidgetModel.fromJson(Map<String, dynamic>.from(item));
if (item.containsKey("mod_name") &&
item['mod_name'] == "my_wallet_appbar") {
list.add(SliverPersistentHeader(
delegate: _SilverAppBarDelegate(
context,
WidgetFactory.create(widgetModel.modName,
isSliver: false, model: item)[0]),
pinned: true,
));
continue;
}
list.addAll(WidgetFactory.create(widgetModel.modName,
isSliver: true, model: item));
}


+ 8
- 0
lib/pages/wallet_page/widgets/wallet_tab_widget.dart Zobrazit soubor

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

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

+ 7
- 6
lib/register.dart Zobrazit soubor

@@ -44,7 +44,6 @@ import 'package:zhiying_base_widget/widgets/others/normal_nav/normal_nav_creater
import 'package:zhiying_base_widget/widgets/search/tabbar/search_tab_creater.dart';
import 'package:zhiying_base_widget/widgets/search_result/sort/search_result_sort_widget.dart';
import 'package:zhiying_base_widget/widgets/search_result/tarbar/search_result_tab_creater.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_appbar/wallet_appbar.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_bil/wallet_bil.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail.dart';
@@ -290,11 +289,13 @@ class BaseWidgetRegister {
// WidgetFactory.regist('profile_carousel', HomeBannerCreater());

// ==================== 钱包
WidgetFactory.regist(
'my_wallet_appbar',
DefaultWidgetCreater((model) => WalletAppbar(
data: model,
)));
// WidgetFactory.regist(
// 'my_wallet_appbar',
// DefaultWidgetCreater((model) => WalletAppbar(
// data: model,
// )));
WidgetFactory.regist('my_wallet_appbar', NormalNavCreater());

WidgetFactory.regist(
'my_wallet_header', DefaultWidgetCreater((model) => WalletData(model)));
WidgetFactory.regist(


+ 37
- 14
lib/widgets/others/normal_nav/normal_nav.dart Zobrazit soubor

@@ -1,14 +1,33 @@
import 'dart:convert' as convert;
import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/mine_page/mine_page.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class NormalNavDelegate extends SliverPersistentHeaderDelegate {
final Map<String, dynamic> data;
double _height;
Color _bgColor;
String _title;
Color _titleColor;

NormalNavDelegate() : super() {
NormalNavDelegate(this.data) : super() {
_height = MediaQueryData.fromWindow(window).padding.top + 44;

String d = data['data'];
Map<String, dynamic> json =
Map<String, dynamic>.from(convert.jsonDecode(d));

if (json.containsKey('app_bar_bg_color')) {
_bgColor = HexColor.fromHex(json['app_bar_bg_color'] ?? '');
}
if (json.containsKey('app_bar_name')) {
_title = json['app_bar_name'] ?? '';
}
if (json.containsKey('app_bar_name')) {
_titleColor = HexColor.fromHex(json['app_bar_name_color']);
}
}

@override
@@ -17,7 +36,8 @@ class NormalNavDelegate extends SliverPersistentHeaderDelegate {
print('${shrinkOffset.toString()}');
double percent = shrinkOffset / _height;
print('${percent.toString()}');
return NormalNav(Colors.red.withOpacity(percent));
return NormalNav(_title, _titleColor,
_bgColor?.withOpacity(percent) ?? Colors.transparent);
}

@override
@@ -32,9 +52,11 @@ class NormalNavDelegate extends SliverPersistentHeaderDelegate {
}

class NormalNav extends StatelessWidget {
final String title;
final Color titleColor;
final Color color;

NormalNav(this.color);
NormalNav(this.title, this.titleColor, this.color);

@override
Widget build(BuildContext context) {
@@ -73,8 +95,9 @@ class NormalNav extends StatelessWidget {
child: Container(
child: Center(
child: Text(
'我的钱包',
style: TextStyle(fontSize: 18, color: Colors.white),
title ?? '',
style: TextStyle(
fontSize: 18, color: titleColor ?? Colors.white),
),
),
),
@@ -83,16 +106,16 @@ class NormalNav extends StatelessWidget {
child: Container(
width: 44,
height: 44,
child: Icon(
Icons.settings,
color: Colors.white,
),
// child: Icon(
// Icons.settings,
// color: Colors.white,
// ),
),
onTap: () {
Navigator.push(context,
CupertinoPageRoute(builder: (context) {
return MinePage();
}));
// Navigator.push(context,
// CupertinoPageRoute(builder: (context) {
// return MinePage();
// }));
},
),
],


+ 1
- 1
lib/widgets/others/normal_nav/normal_nav_creater.dart Zobrazit soubor

@@ -9,7 +9,7 @@ class NormalNavCreater extends WidgetCreater {
SliverPersistentHeader(
pinned: true,
floating: true,
delegate: NormalNavDelegate(),
delegate: NormalNavDelegate(model),
),
];
}


+ 41
- 27
lib/widgets/wallet/wallet_bil/wallet_bil.dart Zobrazit soubor

@@ -1,14 +1,13 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/wallet_page/wallet_detail_page.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_bil/model/wallet_bli_model.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_income/wallet_income_sk.dart';

import 'package:zhiying_comm/zhiying_comm.dart';

import 'package:cached_network_image/cached_network_image.dart';

///查看明细部件
class WalletBil extends StatelessWidget {
Map<String, dynamic> data;
@@ -23,29 +22,44 @@ class WalletBil extends StatelessWidget {
}
return data == null
? WalletIncomeSkeleton()
: Container(
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8)),
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 10),
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
CachedNetworkImage(
imageUrl: model.bilIcon,
width: 36.w,
height: 36.w,
fit: BoxFit.fill,
),
SizedBox(width: 15.w,),
Text(model.bilText, style: TextStyle(fontSize: 24.sp),),
],
),
trailing: InkWell(
child: Text(model.skipText, style: TextStyle(color: Colors.grey),),
: GestureDetector(
onTap: () {
///跳转???
},),
));
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => WalletDetailPage(),
),
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8)),
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 10),
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
CachedNetworkImage(
imageUrl: model.bilIcon,
width: 36.w,
height: 36.w,
fit: BoxFit.fill,
),
SizedBox(
width: 15.w,
),
Text(
model.bilText,
style: TextStyle(fontSize: 24.sp),
),
],
),
trailing: Text(
model.skipText,
style: TextStyle(color: Colors.grey),
),
)),
);
}
}

+ 21
- 5
lib/widgets/wallet/wallet_data/wallet_data.dart Zobrazit soubor

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

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_data/model/wallet_header_model.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data_bloc.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data_sk.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class WalletData extends StatefulWidget {
@@ -92,9 +93,12 @@ class _WalletDataState extends State<WalletData> {
? dataModel[model.headerCashOutKey]
: "",
style: TextStyle(
fontSize: 40.sp,
color: HexColor.fromHex(
model.headerCashOutTextColor)),
fontSize: 40.sp,
color: HexColor.fromHex(
model.headerCashOutTextColor),
fontFamily: 'Din-Bold',
package: 'zhiying_base_widget',
),
),
],
),
@@ -102,6 +106,15 @@ class _WalletDataState extends State<WalletData> {
],
),
GestureDetector(
onTap: () {
SkipModel skipModel = SkipModel(
skipIdentifier: 'pub.flutter.cash_out',
requiredLogin: '1',
requiredTaobaoAuth: '0',
);
RouterUtil.route(
skipModel, skipModel.toJson(), context);
},
child: Container(
decoration: BoxDecoration(
color: Colors.red,
@@ -149,7 +162,10 @@ class _WalletDataState extends State<WalletData> {
? dataModel[item.valueKey]
: "",
style: TextStyle(
color: HexColor.fromHex(item.valueColor), fontSize: 30.sp),
color: HexColor.fromHex(item.valueColor),
fontSize: 30.sp,
fontFamily: 'Din-Bold',
package: 'zhiying_base_widget'),
),
Text(
item.text,


Načítá se…
Zrušit
Uložit