积分充值模块

pull/1/head
张萌 3 years ago
parent 274f77ecb8
commit d9d3eaf202

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -272,7 +272,6 @@ class _Manager {
///id ///id
String get articleReturnList => '/user/articleBorrow/findBorrowByUserId'; String get articleReturnList => '/user/articleBorrow/findBorrowByUserId';
/// ///
String get findEstatelsPament => '/user/dailyPayment/findEstateIsPayment'; String get findEstatelsPament => '/user/dailyPayment/findEstateIsPayment';

@ -1,6 +1,7 @@
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
part 'market_api.dart'; part 'market_api.dart';
part 'profile_api.dart'; part 'profile_api.dart';
class SAASAPI { class SAASAPI {
@ -35,6 +36,7 @@ class SAASAPI {
static _WorkOrder workOrder = _WorkOrder(); static _WorkOrder workOrder = _WorkOrder();
static _Pay pay = _Pay(); static _Pay pay = _Pay();
static _LifePay lifePay = _LifePay(); static _LifePay lifePay = _LifePay();
static _Balance balance = _Balance();
/// ///
static _ProfileApi profile = _ProfileApi(); static _ProfileApi profile = _ProfileApi();
@ -281,6 +283,20 @@ class _WorkOrder {
} }
class _Pay { class _Pay {
///app
String get createPointsOrder => '/app/user/alipay/createPointsOrder';
///app
String get pointsOrderCheckAlipay =>
'/app/user/alipay/pointsOrderCheckAlipay';
///app
String get createBalanceOrder => '/app/user/alipay/createBalanceOrder';
///app
String get balanceOrderCheckAlipay =>
'/app/user/alipay/balanceOrderCheckAlipay';
/// ///
String get createGoodsOrder => '/app/user/alipay/createGoodsOrder'; String get createGoodsOrder => '/app/user/alipay/createGoodsOrder';
@ -313,3 +329,14 @@ class _LifePay {
/// ///
String get findEstateBalance => '/app/user/livingExpenses/findEstateBalance'; String get findEstateBalance => '/app/user/livingExpenses/findEstateBalance';
} }
class _Balance {
///
String get setBalancePayPsd => '/app/user/balance/settingBalancePayPwd';
///
String get buyPointsByBalance => '/app/user/balance/buyPoints';
///app
String get tradeRecordList => '/app/user/tradeRecord/tradeRecordList';
}

@ -1297,13 +1297,12 @@ class $AssetsImagesGen {
AssetGenImage get wxpay => const AssetGenImage('assets/images/wxpay.png'); AssetGenImage get wxpay => const AssetGenImage('assets/images/wxpay.png');
} }
class $AssetsJsonGen {
const $AssetsJsonGen();
}
class $AssetsNewIconGen { class $AssetsNewIconGen {
const $AssetsNewIconGen(); const $AssetsNewIconGen();
/// File path: assets/newIcon/alipay.png
AssetGenImage get alipay => const AssetGenImage('assets/newIcon/alipay.png');
/// File path: assets/newIcon/all_classes.png /// File path: assets/newIcon/all_classes.png
AssetGenImage get allClasses => AssetGenImage get allClasses =>
const AssetGenImage('assets/newIcon/all_classes.png'); const AssetGenImage('assets/newIcon/all_classes.png');
@ -1457,6 +1456,10 @@ class $AssetsNewIconGen {
/// File path: assets/newIcon/srzf.png /// File path: assets/newIcon/srzf.png
AssetGenImage get srzf => const AssetGenImage('assets/newIcon/srzf.png'); AssetGenImage get srzf => const AssetGenImage('assets/newIcon/srzf.png');
/// File path: assets/newIcon/wallet_balance.png
AssetGenImage get walletBalance =>
const AssetGenImage('assets/newIcon/wallet_balance.png');
/// File path: assets/newIcon/xcyhm.png /// File path: assets/newIcon/xcyhm.png
AssetGenImage get xcyhm => const AssetGenImage('assets/newIcon/xcyhm.png'); AssetGenImage get xcyhm => const AssetGenImage('assets/newIcon/xcyhm.png');
@ -1563,7 +1566,6 @@ class Assets {
static const $AssetsHomeGen home = $AssetsHomeGen(); static const $AssetsHomeGen home = $AssetsHomeGen();
static const $AssetsIconsGen icons = $AssetsIconsGen(); static const $AssetsIconsGen icons = $AssetsIconsGen();
static const $AssetsImagesGen images = $AssetsImagesGen(); static const $AssetsImagesGen images = $AssetsImagesGen();
static const $AssetsJsonGen json = $AssetsJsonGen();
static const $AssetsNewIconGen newIcon = $AssetsNewIconGen(); static const $AssetsNewIconGen newIcon = $AssetsNewIconGen();
static const $AssetsStaticGen static = $AssetsStaticGen(); static const $AssetsStaticGen static = $AssetsStaticGen();
static const $AssetsTabGen tab = $AssetsTabGen(); static const $AssetsTabGen tab = $AssetsTabGen();

@ -1,3 +1,4 @@
import 'package:aku_new_community/provider/clock_timer_provider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -42,6 +43,7 @@ class _MyAppState extends State<MyApp> {
ChangeNotifierProvider(create: (context) => AppProvider()), ChangeNotifierProvider(create: (context) => AppProvider()),
ChangeNotifierProvider(create: (context) => SignUpProvider()), ChangeNotifierProvider(create: (context) => SignUpProvider()),
ChangeNotifierProvider(create: (context) => DataProvider()), ChangeNotifierProvider(create: (context) => DataProvider()),
ChangeNotifierProvider(create: (context) => ClockTimerProvider()),
], ],
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
@ -59,7 +61,7 @@ class _MyAppState extends State<MyApp> {
designSize: Size(750, 1334), designSize: Size(750, 1334),
// minTextAdapt: true, // minTextAdapt: true,
// splitScreenMode: true, // splitScreenMode: true,
builder: () => GetMaterialApp( builder: (context) => GetMaterialApp(
onGenerateTitle: (context) => S.of(context)!.appName, onGenerateTitle: (context) => S.of(context)!.appName,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: AppTheme.theme, theme: AppTheme.theme,

@ -20,6 +20,8 @@ class UserInfoModel {
final bool isPointsSignSetting; final bool isPointsSignSetting;
final bool isSign; final bool isSign;
final int? points; final int? points;
final double? balance;
final bool isBalancePayPwd;
final List<ImgModel> imgList; final List<ImgModel> imgList;
String get sexValue { String get sexValue {
@ -55,6 +57,8 @@ class UserInfoModel {
required this.isPointsSignSetting, required this.isPointsSignSetting,
required this.isSign, required this.isSign,
this.points, this.points,
this.balance,
required this.isBalancePayPwd,
required this.imgList, required this.imgList,
}); });
} }

@ -21,6 +21,8 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
isPointsSignSetting: json['isPointsSignSetting'] as bool, isPointsSignSetting: json['isPointsSignSetting'] as bool,
isSign: json['isSign'] as bool, isSign: json['isSign'] as bool,
points: json['points'] as int?, points: json['points'] as int?,
balance: (json['balance'] as num?)?.toDouble(),
isBalancePayPwd: json['isBalancePayPwd'] as bool,
imgList: (json['imgList'] as List<dynamic>) imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>)) .map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),

@ -0,0 +1,37 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'trade_record_list_model.g.dart';
@JsonSerializable()
class TradeRecordListModel extends Equatable {
final int id;
final int type;
final String content;
final double payAmount;
final String createName;
final String createDate;
factory TradeRecordListModel.fromJson(Map<String, dynamic> json) =>
_$TradeRecordListModelFromJson(json);
const TradeRecordListModel({
required this.id,
required this.type,
required this.content,
required this.payAmount,
required this.createName,
required this.createDate,
});
@override
List<Object?> get props => [
id,
type,
content,
payAmount,
createName,
createDate,
];
}

@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'trade_record_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
TradeRecordListModel _$TradeRecordListModelFromJson(
Map<String, dynamic> json) =>
TradeRecordListModel(
id: json['id'] as int,
type: json['type'] as int,
content: json['content'] as String,
payAmount: (json['payAmount'] as num).toDouble(),
createName: json['createName'] as String,
createDate: json['createDate'] as String,
);

@ -385,7 +385,6 @@ class _HomePageState extends State<HomePage>
suffixTitle: '查看全部', suffixTitle: '查看全部',
onTap: () => Get.to(() => ActivityListPage()), onTap: () => Get.to(() => ActivityListPage()),
), ),
24.hb,
_activityItemModels == [] _activityItemModels == []
? SizedBox() ? SizedBox()
: Container( : Container(

@ -1,6 +1,8 @@
import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/personal/user_profile_page.dart'; import 'package:aku_new_community/pages/personal/user_profile_page.dart';
import 'package:aku_new_community/pages/personal/wallet/wallet_recharge_page.dart';
import 'package:aku_new_community/pages/personal/wallet/wallet_trade_record_page.dart';
import 'package:aku_new_community/pages/setting_page/settings_page.dart'; import 'package:aku_new_community/pages/setting_page/settings_page.dart';
import 'package:aku_new_community/pages/sign/login/other_login_page.dart'; import 'package:aku_new_community/pages/sign/login/other_login_page.dart';
import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/provider/user_provider.dart';
@ -10,6 +12,7 @@ import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_avatar_widget.dart'; import 'package:aku_new_community/widget/bee_avatar_widget.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -290,172 +293,300 @@ class _PersonalIndexState extends State<PersonalIndex>
], ],
), ),
), ),
Padding( _columBody(),
padding: EdgeInsets.only(top: 600.w),
child: Column(
children: [
Container(
width: 686.w,
height: 282.w,
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.1),
offset: Offset(1, 1),
),
],
),
margin: EdgeInsets.only(left: 32.w, right: 32.w),
padding: EdgeInsets.only(
top: 24.w, left: 32.w, right: 32.w),
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: [
_homeTitle('我的订单', () {
Get.to(() => OrderPage(initIndex: 0));
}, '查看全部'),
50.hb,
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_orderButton(
name: '待付款',
path: Assets.newIcon.icDaifuk.path,
index: 1,
),
_orderButton(
name: '待发货',
path: Assets.newIcon.imgDaifah.path,
index: 2,
),
_orderButton(
name: '待收货',
path: Assets.newIcon.icDaishouh.path,
index: 3,
),
_orderButton(
name: '已完成',
path: Assets.newIcon.imgDaipingj.path,
index: 4,
),
],
),
],
),
),
// Container(
// width: double.infinity,
// height: 100.w,
// clipBehavior: Clip.antiAlias,
// decoration: BoxDecoration(
// // color: Colors.white,
// borderRadius: BorderRadius.circular(16.w)),
// margin: EdgeInsets.symmetric(horizontal: 32.w),
// child: Material(
// color: Colors.white,
// child: InkWell(
// onTap: () {
// Get.to(() => ClockInPage());
// },
// borderRadius: BorderRadius.circular(16.w),
// child: Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 32.w, vertical: 24.w),
// child: Row(
// children: [
// '我的积分'.text.size(30.sp).black.bold.make(),
// Spacer(),
// // Assets.icons.intergral
// // .image(width: 32.w, height: 32.w),
// // 16.w.widthBox,
// // '123'.text.size(28.sp).black.make(),
// // 16.w.widthBox,
// Icon(
// CupertinoIcons.right_chevron,
// size: 24.w,
// ),
// ],
// ),
// ),
// ),
// ),
// ),
Container(
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.1),
offset: Offset(1, 1),
),
],
),
margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w),
child: Column(
children: [
Row(
children: [
22.wb,
'其他功能'
.text
.size(32.sp)
.color(Color(0xFF2B2B2B))
.bold
.make(),
Spacer(),
],
),
24.hb,
_function('我的积分', Assets.newIcon.icJifen.path,
() => Get.to(() => ClockInPage()), ''),
_function(
'我的房屋',
Assets.newIcon.icWdfw.path,
() {
Get.to(() => MyHousePage());
},
// () => HouseOwnersPage(
// identify: 4,
// ),
'${UserTool.userProvider.defaultHouseString}',
),
_function('我的家庭', Assets.newIcon.icWdjt.path, () {
Get.to(() => MyFamilyPage());
}, ''),
// _function('我的车位', R.ASSETS_ICONS_ICON_MY_CARSEAT_PNG,
// () => CarParkingPage(), ''),
// 36.hb,
// _function('我的车', R.ASSETS_ICONS_ICON_MY_CAR_PNG,
// () => CarManagePage(), ''),
// 36.hb,
_function('我的访客', Assets.newIcon.icWdfk.path, () {
BotToast.showText(
text: '本小区尚未配置门禁设备',
align: Alignment(0, 0.5));
}, ''),
_function(
'收货地址',
Assets.newIcon.icShdz.path,
() => Get.to(() => AddressListPage(
canBack: false,
)),
''),
],
),
),
],
),
),
], ],
)), )),
)); ));
} }
Padding _columBody() {
var wallet = Container(
margin: EdgeInsets.symmetric(horizontal: 32.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
),
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Row(
children: [
'我的钱包'.text.size(32.sp).color(Colors.black).make(),
Spacer(),
GestureDetector(
onTap: () {
Get.to(() => WalletTradeRecordPage());
},
child: Row(
children: [
'交易记录'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
8.wb,
Icon(
CupertinoIcons.chevron_right,
color: Colors.black.withOpacity(0.45),
size: 32.w,
),
],
),
),
],
),
),
BeeDivider.horizontal(),
Padding(
padding: EdgeInsets.symmetric(vertical: 24.w),
child: Row(
children: [
Expanded(
child: Column(
children: [
'${UserTool.userProvider.userInfoModel!.points ?? 0}'
.text
.size(40.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
12.hb,
'积分'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
),
Expanded(
child: Column(
children: [
'${UserTool.userProvider.userInfoModel!.balance ?? 0}'
.text
.size(40.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
12.hb,
'余额'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
)
],
),
),
BeeDivider.horizontal(),
Row(
children: [
Expanded(
child: GestureDetector(
onTap: () async {
await Get.to(WalletRechargePage(
initIndex: 0,
));
_refreshController.callRefresh();
},
child: Material(
color: Colors.transparent,
child: Center(
child: '充值'
.text
.size(26.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
),
))),
Container(
height: 84.w,
width: 2.w,
color: Colors.black.withOpacity(0.06),
),
Expanded(
child: GestureDetector(
onTap: () async {
await Get.to(WalletRechargePage(
initIndex: 1,
));
_refreshController.callRefresh();
},
child: Material(
color: Colors.transparent,
child: Center(
child: '购买积分'
.text
.size(26.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
),
)))
],
)
],
),
);
var order = Container(
width: 686.w,
height: 282.w,
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.1),
offset: Offset(1, 1),
),
],
),
margin: EdgeInsets.only(left: 32.w, right: 32.w),
padding: EdgeInsets.only(top: 24.w, left: 32.w, right: 32.w),
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: [
_homeTitle('我的订单', () {
Get.to(() => OrderPage(initIndex: 0));
}, '查看全部'),
50.hb,
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_orderButton(
name: '待付款',
path: Assets.newIcon.icDaifuk.path,
index: 1,
),
_orderButton(
name: '待发货',
path: Assets.newIcon.imgDaifah.path,
index: 2,
),
_orderButton(
name: '待收货',
path: Assets.newIcon.icDaishouh.path,
index: 3,
),
_orderButton(
name: '已完成',
path: Assets.newIcon.imgDaipingj.path,
index: 4,
),
],
),
],
),
);
var extra = Container(
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.1),
offset: Offset(1, 1),
),
],
),
margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w),
child: Column(
children: [
Row(
children: [
22.wb,
'其他功能'.text.size(32.sp).color(Color(0xFF2B2B2B)).bold.make(),
Spacer(),
],
),
24.hb,
_function('我的积分', Assets.newIcon.icJifen.path,
() => Get.to(() => ClockInPage()), ''),
_function(
'我的房屋',
Assets.newIcon.icWdfw.path,
() {
Get.to(() => MyHousePage());
},
// () => HouseOwnersPage(
// identify: 4,
// ),
'${UserTool.userProvider.defaultHouseString}',
),
_function('我的家庭', Assets.newIcon.icWdjt.path, () {
Get.to(() => MyFamilyPage());
}, ''),
// _function('我的车位', R.ASSETS_ICONS_ICON_MY_CARSEAT_PNG,
// () => CarParkingPage(), ''),
// 36.hb,
// _function('我的车', R.ASSETS_ICONS_ICON_MY_CAR_PNG,
// () => CarManagePage(), ''),
// 36.hb,
_function('我的访客', Assets.newIcon.icWdfk.path, () {
BotToast.showText(text: '本小区尚未配置门禁设备', align: Alignment(0, 0.5));
}, ''),
_function(
'收货地址',
Assets.newIcon.icShdz.path,
() => Get.to(() => AddressListPage(
canBack: false,
)),
''),
],
),
);
return Padding(
padding: EdgeInsets.only(top: 560.w),
child: Column(
children: [
wallet,
48.hb,
order,
// Container(
// width: double.infinity,
// height: 100.w,
// clipBehavior: Clip.antiAlias,
// decoration: BoxDecoration(
// // color: Colors.white,
// borderRadius: BorderRadius.circular(16.w)),
// margin: EdgeInsets.symmetric(horizontal: 32.w),
// child: Material(
// color: Colors.white,
// child: InkWell(
// onTap: () {
// Get.to(() => ClockInPage());
// },
// borderRadius: BorderRadius.circular(16.w),
// child: Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 32.w, vertical: 24.w),
// child: Row(
// children: [
// '我的积分'.text.size(30.sp).black.bold.make(),
// Spacer(),
// // Assets.icons.intergral
// // .image(width: 32.w, height: 32.w),
// // 16.w.widthBox,
// // '123'.text.size(28.sp).black.make(),
// // 16.w.widthBox,
// Icon(
// CupertinoIcons.right_chevron,
// size: 24.w,
// ),
// ],
// ),
// ),
// ),
// ),
// ),
extra,
],
),
);
}
_homeTitle(String title, VoidCallback onTap, String suffixTitle) { _homeTitle(String title, VoidCallback onTap, String suffixTitle) {
return Row( return Row(
children: [ children: [

@ -0,0 +1,210 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/models/wallet/trade_record_list_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class BalanceRecordView extends StatefulWidget {
const BalanceRecordView({Key? key}) : super(key: key);
@override
_BalanceRecordViewState createState() => _BalanceRecordViewState();
}
class _BalanceRecordViewState extends State<BalanceRecordView> {
EasyRefreshController _refreshController = EasyRefreshController();
List<TradeRecordListModel> _models = [];
int _pageNum = 1;
int _size = 10;
DateTime _pickTime = DateTime.now();
int _pickType = 0;
Map<int, String> _types = {
1: '支付',
2: '退还',
3: '充值',
4: '收入',
5: '提现',
6: '抵扣',
};
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: Row(
children: [
GestureDetector(
onTap: () async {
var date = await BeeDatePicker.monthPicker(
DateTime.now().subtract(Duration(days: 365)));
if (date != null) {
_pickTime = date;
}
setState(() {});
},
child: Row(
children: [
'${_pickTime.year}${_pickTime.month}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Icon(
CupertinoIcons.chevron_down,
size: 32.w,
color: Colors.black.withOpacity(0.45),
)
],
),
),
Spacer(),
MaterialButton(
color: Colors.black.withOpacity(0.06),
onPressed: () async {
await showModalBottomSheet(
context: context,
builder: (context) {
return BeePickerBox(
onPressed: () {
Get.back();
setState(() {});
},
child: CupertinoPicker.builder(
itemExtent: 60.w,
childCount: _types.values.length,
onSelectedItemChanged: (index) {
_pickType = _types.keys.toList()[index];
},
itemBuilder: (context, index) {
var str = _types.values.toList()[index];
return Center(
child: str.text.size(32.sp).isIntrinsic.make(),
);
},
),
);
},
);
},
shape: StadiumBorder(),
elevation: 0,
child: Row(
children: [
'${_pickType == 0 ? '全部类型' : _types[_pickType]}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Icon(
CupertinoIcons.chevron_down,
size: 24.w,
color: Colors.black.withOpacity(0.25),
)
],
),
),
],
),
),
Flexible(
child: Container(
color: Colors.white,
child: EasyRefresh(
header: MaterialHeader(),
footer: MaterialFooter(),
firstRefresh: true,
controller: _refreshController,
onRefresh: () async {
_pageNum = 1;
var baseList = await NetUtil()
.getList(SAASAPI.balance.tradeRecordList, params: {
'pageNum': _pageNum,
'size': _size,
'modelType': 0,
'type': _pickType,
'createDate': _pickTime,
});
_models = baseList.rows
.map((e) => TradeRecordListModel.fromJson(e))
.toList();
},
onLoad: () async {
_pageNum++;
var baseList = await NetUtil()
.getList(SAASAPI.balance.tradeRecordList, params: {
'pageNum': _pageNum,
'size': _size,
'modelType': 0,
'type': _pickType,
'createDate': _pickTime,
});
if (baseList.total > _models.length) {
_models.addAll(baseList.rows
.map((e) => TradeRecordListModel.fromJson(e))
.toList());
} else {
_refreshController.finishLoad(noMore: true);
}
},
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
children: _models.map((e) => _buildCard(e)).toList(),
),
),
),
),
],
);
}
bool incom(type) => [2, 3, 4].contains(type);
Widget _buildCard(TradeRecordListModel model) {
return Column(
children: [
Row(
children: [
'${_types[model.type]}-${model.content}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Spacer(),
'${incom(model.type) ? '+' : '-'}¥${model.payAmount}'
.text
.size(28.sp)
.color(incom(model.type)
? Colors.red
: Colors.black.withOpacity(0.85))
.make(),
],
),
8.hb,
'${DateUtil.formatDateStr(model.createDate, format: 'MM/dd HH:mm')}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
],
);
}
}

@ -0,0 +1,91 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class InputPayPasswordDialog extends StatefulWidget {
final int balance;
const InputPayPasswordDialog({
Key? key,
required this.balance,
}) : super(key: key);
@override
_InputPayPasswordDialogState createState() => _InputPayPasswordDialogState();
}
class _InputPayPasswordDialogState extends State<InputPayPasswordDialog> {
String? _currentCode;
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding: EdgeInsets.only(bottom: 300.w),
child: Material(
borderRadius: BorderRadius.circular(24.w),
child: Container(
width: 630.w,
height: 480.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(24.w)),
child: Column(
children: [
96.hb,
'请输入您的支付密码'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.bold
.make(),
40.hb,
'支付密码仅用于对钱包余额支付时确认'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
PinFieldAutoFill(
autoFocus: true,
currentCode: _currentCode,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
codeLength: 6,
onCodeChanged: (code) async {
if ((code?.length ?? 0) >= 6) {
Get.back();
var base = await NetUtil()
.post(SAASAPI.balance.buyPointsByBalance, params: {
'balance': widget.balance,
'balancePayPwd': code
});
Get.back();
if (!base.success) {
BotToast.showText(text: base.msg);
}
}
_currentCode = code;
},
decoration: UnderlineDecoration(
colorBuilder: FixedColorListBuilder([
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
])),
)
],
),
),
),
),
);
}
}

@ -0,0 +1,240 @@
import 'dart:ui';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/life_pay/pay_util.dart';
import 'package:aku_new_community/pages/personal/wallet/input_pay_password_dialog.dart';
import 'package:aku_new_community/pages/personal/wallet/set_pay_password_dialog.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/buttons/bee_check_radio.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class PayWayDialog extends StatefulWidget {
final bool isBalance;
final int amount;
final bool insufficientBalance;
const PayWayDialog(
{Key? key,
required this.isBalance,
required this.amount,
required this.insufficientBalance})
: super(key: key);
@override
_PayWayDialogState createState() => _PayWayDialogState();
}
class _PayWayDialogState extends State<PayWayDialog> {
List<int> _payType = [];
@override
void initState() {
if (widget.isBalance) {
_payType.add(1);
} else {
if (widget.insufficientBalance) {
_payType.add(1);
} else {
_payType.add(0);
}
}
super.initState();
}
@override
Widget build(BuildContext context) {
var wallet = GestureDetector(
onTap: () {
if (widget.insufficientBalance) {
return;
}
_payType.clear();
_payType.add(0);
setState(() {});
},
child: ClipRect(
child: Stack(
children: [
Material(
color: Colors.transparent,
child: Row(
children: [
Assets.newIcon.walletBalance.image(width: 48.w, height: 48.w),
8.wb,
'钱包余额'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
16.wb,
Visibility(
visible: widget.insufficientBalance,
child:
'钱包余额不足'.text.size(24.sp).color(Colors.red).make()),
Spacer(),
BeeCheckRadio(
groupValue: _payType,
value: 0,
size: 36.w,
indent: Icon(
CupertinoIcons.checkmark_alt,
color: Colors.black,
size: 28.w,
),
),
],
),
),
BackdropFilter(
filter: ImageFilter.blur(
sigmaX: widget.insufficientBalance ? 1 : 0,
sigmaY: widget.insufficientBalance ? 1 : 0),
child: Container(),
),
],
),
),
);
var alipay = GestureDetector(
onTap: () {
_payType.clear();
_payType.add(1);
setState(() {});
},
child: Material(
color: Colors.transparent,
child: Row(
children: [
Assets.newIcon.alipay.image(width: 48.w, height: 48.w),
8.wb,
'支付宝'.text.size(28.sp).color(Colors.black.withOpacity(0.85)).make(),
Spacer(),
BeeCheckRadio(
groupValue: _payType,
value: 1,
size: 36.w,
indent: Icon(
CupertinoIcons.checkmark_alt,
color: Colors.black,
size: 28.w,
),
),
],
),
),
);
return Material(
color: Colors.transparent,
child: Container(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
width: double.infinity,
color: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
'支付'
.text
.size(32.sp)
.bold
.isIntrinsic
.color(Colors.black.withOpacity(0.85))
.make(),
48.hb,
Column(
children: [
'¥'
.richText
.color(Colors.black.withOpacity(0.85))
.size(26.sp)
.withTextSpanChildren([
widget.amount
.toString()
.textSpan
.size(40.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
]).make(),
Offstage(
offstage: widget.isBalance,
child: '总共购买${widget.amount * 10}积分'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
60.hb,
Offstage(
offstage: widget.isBalance,
child: Column(
children: [
wallet,
40.hb,
],
),
),
alipay,
80.hb,
BeeLongButton(
width: double.infinity,
onPressed: () async {
if (_payType.contains(0)) {
if (!UserTool
.userProvider.userInfoModel!.isBalancePayPwd) {
Get.dialog(SetPayPasswordDialog());
} else {
Get.back();
Get.dialog(
InputPayPasswordDialog(balance: widget.amount));
}
return;
}
if (_payType.contains(1)) {
var cancel = BotToast.showLoading();
await _alipayFuc();
cancel();
Get.back();
return;
}
},
text: '确认支付${widget.amount}'),
],
),
],
),
),
);
}
Future _alipayFuc() async {
if (widget.isBalance) {
var base = await NetUtil().post(SAASAPI.pay.createBalanceOrder, params: {
'balance': widget.amount,
});
if (base.success) {
var re = await PayUtil()
.callAliPay(base.data, SAASAPI.pay.balanceOrderCheckAlipay);
} else {
BotToast.showText(text: base.msg);
}
} else {
var base = await NetUtil().post(SAASAPI.pay.createPointsOrder, params: {
'payAmount': widget.amount,
});
if (base.success) {
var re = await PayUtil()
.callAliPay(base.data, SAASAPI.pay.pointsOrderCheckAlipay);
} else {
BotToast.showText(text: base.msg);
}
}
}
}

@ -0,0 +1,210 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/models/wallet/trade_record_list_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class PointRecordView extends StatefulWidget {
const PointRecordView({Key? key}) : super(key: key);
@override
_PointRecordViewState createState() => _PointRecordViewState();
}
class _PointRecordViewState extends State<PointRecordView> {
EasyRefreshController _refreshController = EasyRefreshController();
List<TradeRecordListModel> _models = [];
int _pageNum = 1;
int _size = 10;
DateTime _pickTime = DateTime.now();
int _pickType = 0;
Map<int, String> _types = {
1: '支付',
2: '退还',
3: '充值',
4: '收入',
5: '提现',
6: '抵扣',
};
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: Row(
children: [
GestureDetector(
onTap: () async {
var date = await BeeDatePicker.monthPicker(
DateTime.now().subtract(Duration(days: 365)));
if (date != null) {
_pickTime = date;
}
setState(() {});
},
child: Row(
children: [
'${_pickTime.year}${_pickTime.month}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Icon(
CupertinoIcons.chevron_down,
size: 32.w,
color: Colors.black.withOpacity(0.45),
)
],
),
),
Spacer(),
MaterialButton(
color: Colors.black.withOpacity(0.06),
onPressed: () async {
await showModalBottomSheet(
context: context,
builder: (context) {
return BeePickerBox(
onPressed: () {
Get.back();
setState(() {});
},
child: CupertinoPicker.builder(
itemExtent: 60.w,
childCount: _types.values.length,
onSelectedItemChanged: (index) {
_pickType = _types.keys.toList()[index];
},
itemBuilder: (context, index) {
var str = _types.values.toList()[index];
return Center(
child: str.text.size(32.sp).isIntrinsic.make(),
);
},
),
);
},
);
},
shape: StadiumBorder(),
elevation: 0,
child: Row(
children: [
'${_pickType == 0 ? '全部类型' : _types[_pickType]}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Icon(
CupertinoIcons.chevron_down,
size: 24.w,
color: Colors.black.withOpacity(0.25),
)
],
),
),
],
),
),
Flexible(
child: Container(
color: Colors.white,
child: EasyRefresh(
header: MaterialHeader(),
footer: MaterialFooter(),
firstRefresh: true,
controller: _refreshController,
onRefresh: () async {
_pageNum = 1;
var baseList = await NetUtil()
.getList(SAASAPI.balance.tradeRecordList, params: {
'pageNum': _pageNum,
'size': _size,
'modelType': 1,
'type': _pickType,
'createDate': _pickTime,
});
_models = baseList.rows
.map((e) => TradeRecordListModel.fromJson(e))
.toList();
},
onLoad: () async {
_pageNum++;
var baseList = await NetUtil()
.getList(SAASAPI.balance.tradeRecordList, params: {
'pageNum': _pageNum,
'size': _size,
'modelType': 0,
'type': _pickType,
'createDate': _pickTime,
});
if (baseList.total > _models.length) {
_models.addAll(baseList.rows
.map((e) => TradeRecordListModel.fromJson(e))
.toList());
} else {
_refreshController.finishLoad(noMore: true);
}
},
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
children: _models.map((e) => _buildCard(e)).toList(),
),
),
),
),
],
);
}
bool incom(type) => [2, 3, 4].contains(type);
Widget _buildCard(TradeRecordListModel model) {
return Column(
children: [
Row(
children: [
'${_types[model.type]}-${model.content}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Spacer(),
'${incom(model.type) ? '+' : '-'}¥${model.payAmount}'
.text
.size(28.sp)
.color(incom(model.type)
? Colors.red
: Colors.black.withOpacity(0.85))
.make(),
],
),
8.hb,
'${DateUtil.formatDateStr(model.createDate, format: 'MM/dd HH:mm')}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
],
);
}
}

@ -0,0 +1,76 @@
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/pages/personal/wallet/set_pay_password_verify_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class SetPayPasswordDialog extends StatefulWidget {
const SetPayPasswordDialog({Key? key, }) : super(key: key);
@override
_SetPayPasswordDialogState createState() => _SetPayPasswordDialogState();
}
class _SetPayPasswordDialogState extends State<SetPayPasswordDialog> {
String? _currentCode;
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding:EdgeInsets.only(bottom: 300.w),
child: Material(
borderRadius: BorderRadius.circular(24.w),
child: Container(
width: 630.w,
height: 480.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(24.w)),
child: Column(
children: [
96.hb,
'请先设置支付密码'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.bold
.make(),
40.hb,
'支付密码仅用于对钱包余额支付时确认'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
PinFieldAutoFill(
autoFocus: true,
currentCode: _currentCode,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
codeLength: 6,
onCodeChanged: (code) async {
if ((code?.length ?? 0) >= 6) {
Get.back();
Get.dialog(SetPayVerifyPasswordDialog(firstCode:code!,));
}
_currentCode = code;
},
decoration: UnderlineDecoration(
colorBuilder: FixedColorListBuilder([
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
])),
)
],
),
),
),
),
);
}
}

@ -0,0 +1,118 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/pages/personal/wallet/input_pay_password_dialog.dart';
import 'package:aku_new_community/pages/sign/login/psd_verify.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class SetPayVerifyPasswordDialog extends StatefulWidget {
final String firstCode;
const SetPayVerifyPasswordDialog({Key? key, required this.firstCode})
: super(key: key);
@override
_SetPayVerifyPasswordDialogState createState() =>
_SetPayVerifyPasswordDialogState();
}
class _SetPayVerifyPasswordDialogState
extends State<SetPayVerifyPasswordDialog> {
String _currentCode = '';
bool get checkVerify => widget.firstCode == _currentCode;
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding: EdgeInsets.only(bottom: 300.w),
child: Material(
borderRadius: BorderRadius.circular(24.w),
child: Container(
width: 630.w,
height: 480.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(24.w)),
child: Column(
children: [
96.hb,
'请再次输入支付密码'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.bold
.make(),
40.hb,
'支付密码仅用于对钱包余额支付时确认'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
PinFieldAutoFill(
autoFocus: true,
currentCode: _currentCode,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
codeLength: 6,
onCodeChanged: (code) async {
_currentCode = code ?? '';
if ((code?.length ?? 0) >= 6) {
print(checkVerify);
if (!checkVerify) {
return;
}
var base = await NetUtil()
.post(SAASAPI.balance.setBalancePayPsd, params: {
'pwd': widget.firstCode,
'rePwd': _currentCode,
});
if (base.success) {
Get.back();
UserTool.userProvider.updateUserInfo();
} else {
BotToast.showText(text: base.msg);
Get.back();
}
}
setState(() {});
},
decoration: UnderlineDecoration(
colorBuilder: FixedColorListBuilder([
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
])),
),
24.hb,
Offstage(
offstage: (_currentCode.isEmptyOrNull) || (checkVerify),
child: Row(
children: [
'密码输入不一致'
.text
.size(24.sp)
.isIntrinsic
.color(Colors.red)
.make(),
],
),
)
],
),
),
),
),
);
}
}

@ -0,0 +1,496 @@
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/personal/wallet/pay_way_dialog.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:collection/src/iterable_extensions.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';
import 'package:velocity_x/src/extensions/num_ext.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class WalletRechargePage extends StatefulWidget {
final initIndex;
const WalletRechargePage({Key? key, this.initIndex = 0}) : super(key: key);
@override
_WalletRechargePageState createState() => _WalletRechargePageState();
}
class _WalletRechargePageState extends State<WalletRechargePage>
with SingleTickerProviderStateMixin {
int _currentIndex = 0;
int _currentSelect = 0;
late TabController _tabController;
List<String> _tabs = ['余额充值', '积分充值'];
List<int> _balanceValue = [10, 20, 30, 50, 00, 200, 300, 500];
List<int> _pointValue = [10, 200, 300, 500, 1000, 2000, 5000, 10000];
int _rechargeValue = 0;
@override
void initState() {
_tabController =
TabController(length: 2, vsync: this, initialIndex: widget.initIndex);
_currentIndex = widget.initIndex;
_rechargeValue = widget.initIndex == 0 ? _balanceValue[0] : _pointValue[0];
super.initState();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '钱包充值',
actions: [
TextButton(
onPressed: () {},
child: '账单'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
),
],
body: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Row(
children: [
'余额:${UserTool.userProvider.userInfoModel!.balance ?? 0}'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
64.wb,
'积分:'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
'${UserTool.userProvider.userInfoModel!.points ?? 0}'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
decoration: BoxDecoration(color: Colors.white),
child: Column(
children: [
Row(
children: _tabs
.mapIndexed((index, element) => GestureDetector(
onTap: () {
_currentIndex = index;
_tabController.animateTo(_currentIndex);
setState(() {});
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
element.text
.size(28.sp)
.fontWeight(_currentIndex == index
? FontWeight.bold
: FontWeight.normal)
.color(Colors.black.withOpacity(
_currentIndex == index ? 0.85 : 0.65))
.make(),
8.hb,
AnimatedOpacity(
duration: Duration(microseconds: 500),
opacity: _currentIndex == index ? 1 : 0,
child: Container(
width: 40.w,
height: 8.w,
decoration: BoxDecoration(
color: Colors.black,
borderRadius:
BorderRadius.circular(4.w),
),
),
)
],
),
))
.toList()
.sepWidget(separate: 48.wb),
),
48.hb,
Expanded(
child: TabBarView(controller: _tabController, children: [
_balanceView(),
_pointView(),
]),
),
],
),
),
),
],
),
bottomNavi: Padding(
padding: EdgeInsets.only(
left: 32.w,
right: 32.w,
bottom: 32.w + MediaQuery.of(context).padding.bottom),
child: BeeLongButton(
onPressed: () async {
if (_currentSelect == 9) {
_rechargeValue = 0;
Get.bottomSheet(_customValueDialog(_currentIndex == 0));
} else {
Get.bottomSheet(PayWayDialog(
isBalance: _currentIndex == 0,
amount: _rechargeValue,
insufficientBalance: _rechargeValue >
(UserTool.userProvider.userInfoModel!.balance ?? 0)));
}
},
text: '下一步'),
),
);
}
Widget _balanceView() {
return GridView.count(
crossAxisCount: 3,
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
children: [
..._balanceValue
.mapIndexed((index, e) => _card(index, e, true))
.toList(),
_customValueCard(9, true)
],
);
}
Widget _pointView() {
return GridView.count(
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
crossAxisCount: 3,
children: [
..._pointValue
.mapIndexed((index, element) => _card(index, element, false))
.toList(),
_customValueCard(9, false)
],
);
}
Widget _card(int index, int value, bool isBalance) {
return GestureDetector(
onTap: () {
_currentSelect = index;
_rechargeValue = isBalance ? _balanceValue[index] : (_pointValue[index]~/10);
setState(() {});
},
child: Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(16.w),
child: Stack(
clipBehavior: Clip.antiAliasWithSaveLayer,
fit: StackFit.passthrough,
children: [
Container(
width: 214.w,
height: 202.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
color:
_currentSelect != index ? Color(0xFFF9F9F9) : Colors.black,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Offstage(
offstage: isBalance,
child: Assets.icons.intergral
.image(width: 48.w, height: 48.w)),
8.hb,
'$value '
.richText
.withTextSpanChildren([
'${isBalance ? '' : '积分'} '
.textSpan
.size(26.sp)
.color(_currentSelect == index
? Color(0xFFFBE541)
: Colors.black.withOpacity(0.85))
.make(),
])
.color(_currentSelect == index
? Color(0xFFFBE541)
: Colors.black.withOpacity(0.85))
.size(40.w)
.make(),
16.hb,
Offstage(
offstage: isBalance,
child: '${value ~/ 10}'
.text
.size(26.sp)
.color(_currentSelect == index
? Color(0xFFFBE541)
: Colors.black.withOpacity(0.85))
.make(),
),
],
),
),
AnimatedPositioned(
bottom: 0,
right: 0,
child: Offstage(
offstage: _currentSelect != index,
child: ClipPath(
clipper: _TriangleClipPath(),
child: Container(
width: 40.w,
height: 48.w,
color: Color(0xFFFBE541),
child: Transform.translate(
offset: Offset(10.w, 12.w),
child: Icon(
CupertinoIcons.checkmark_alt,
size: 24.w,
),
),
),
),
),
duration: Duration(microseconds: 500))
],
),
),
);
}
Widget _customValueCard(int index, bool isBalance) {
return GestureDetector(
onTap: () {
_currentSelect = index;
setState(() {});
},
child: Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(16.w),
child: Stack(
clipBehavior: Clip.antiAliasWithSaveLayer,
fit: StackFit.passthrough,
children: [
Container(
width: 214.w,
height: 202.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
color:
_currentSelect != index ? Color(0xFFF9F9F9) : Colors.black,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Offstage(
offstage: isBalance,
child: Assets.icons.intergral
.image(width: 48.w, height: 48.w)),
8.hb,
''
.richText
.withTextSpanChildren([
'${isBalance ? '其他金额' : '其他积分'} '
.textSpan
.size(26.sp)
.color(_currentSelect == index
? Color(0xFFFBE541)
: Colors.black.withOpacity(0.85))
.make(),
])
.color(_currentSelect == index
? Color(0xFFFBE541)
: Colors.black.withOpacity(0.85))
.size(40.w)
.make(),
16.hb,
Offstage(
offstage: isBalance,
child: '自定义'
.text
.size(26.sp)
.color(_currentSelect == index
? Color(0xFFFBE541)
: Colors.black.withOpacity(0.85))
.make(),
),
],
),
),
AnimatedPositioned(
bottom: 0,
right: 0,
child: Offstage(
offstage: _currentSelect != index,
child: ClipPath(
clipper: _TriangleClipPath(),
child: Container(
width: 40.w,
height: 48.w,
color: Color(0xFFFBE541),
child: Transform.translate(
offset: Offset(10.w, 12.w),
child: Icon(
CupertinoIcons.checkmark_alt,
size: 24.w,
),
),
),
),
),
duration: Duration(microseconds: 500))
],
),
),
);
}
Widget _customValueDialog(bool isBalance) {
return StatefulBuilder(
builder: (context, reSet) {
return Material(
color: Colors.transparent,
child: Container(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
width: double.infinity,
color: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
'${isBalance ? '充值金额' : '充值积分'}'
.text
.size(32.sp)
.bold
.isIntrinsic
.color(Colors.black.withOpacity(0.85))
.make(),
48.hb,
Container(
height: 88.w,
decoration: BoxDecoration(
color: Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(16.w)),
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Row(
children: [
24.wb,
'¥'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
12.wb,
Expanded(
child: TextField(
autofocus: true,
onChanged: (text) {
if (text.trim().isNotEmpty) {
_rechargeValue = int.parse(text);
reSet(() {});
}
},
inputFormatters: [
FilteringTextInputFormatter.digitsOnly
],
keyboardType: TextInputType.number,
decoration: InputDecoration(border: InputBorder.none),
)),
Offstage(
offstage: isBalance,
child: Row(
children: [
Assets.icons.intergral
.image(width: 32.w, height: 32.w),
16.wb,
(_rechargeValue * 10)
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.855))
.make(),
12.wb,
],
),
),
GestureDetector(
onTap: () {
if (_rechargeValue == 0) {
BotToast.showText(text: '金额不能为0');
return;
}
Get.back();
Get.bottomSheet(PayWayDialog(
insufficientBalance: (UserTool.userProvider
.userInfoModel!.balance ??
0) <
_rechargeValue,
isBalance: isBalance,
amount: _rechargeValue));
},
child: Material(
child: Container(
width: 132.w,
color: Color(0xFFFBE541),
child: Center(
child: '去支付'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
),
),
),
),
],
),
)
],
),
),
);
},
);
}
}
class _TriangleClipPath extends CustomClipper<Path> {
@override
Path getClip(Size size) {
Path path = Path();
path.moveTo(0, size.height);
path.lineTo(size.width, size.height);
path.lineTo(size.width, 0 + 5.w);
path.lineTo(0, size.height);
path.close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return false;
}
}

@ -0,0 +1,44 @@
import 'package:aku_new_community/pages/personal/wallet/point_record_view.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'balance_record_view.dart';
class WalletTradeRecordPage extends StatefulWidget {
const WalletTradeRecordPage({Key? key}) : super(key: key);
@override
_WalletTradeRecordPageState createState() => _WalletTradeRecordPageState();
}
class _WalletTradeRecordPageState extends State<WalletTradeRecordPage>
with SingleTickerProviderStateMixin {
List<String> _tabs = ['余额账单', '积分账单'];
late TabController _tabController;
@override
void initState() {
_tabController = TabController(length: _tabs.length, vsync: this);
super.initState();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: BeeTabBar(
controller: _tabController,
tabs: _tabs,
scrollable: true,
),
body: TabBarView(
controller: _tabController,
children: [
BalanceRecordView(),
PointRecordView(),
],
),
);
}
}

@ -1,10 +1,12 @@
import 'package:aku_new_community/pages/sign/sign_func.dart'; import 'package:aku_new_community/pages/sign/sign_func.dart';
import 'package:aku_new_community/provider/clock_timer_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
import 'package:sms_autofill/sms_autofill.dart'; import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -38,6 +40,7 @@ class _CodeMessagePageState extends State<CodeMessagePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ClockTimerProvider clockTimer = Provider.of<ClockTimerProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '', title: '',
body: SafeArea( body: SafeArea(
@ -115,14 +118,14 @@ class _CodeMessagePageState extends State<CodeMessagePage> {
.communityModel!.id); .communityModel!.id);
if (base.success) { if (base.success) {
_errorMessage = null; _errorMessage = null;
UserTool.appProvider.startTimer(); clockTimer.startTimer();
} else { } else {
BotToast.showText(text: base.msg); BotToast.showText(text: base.msg);
} }
}, },
child: (UserTool.appProvider.second >= 60 child: (clockTimer.second >= 60
? '重新发送验证码' ? '重新发送验证码'
: '${UserTool.appProvider.second}秒后可重新发送') : '${clockTimer.second}秒后可重新发送')
.text .text
.size(28.sp) .size(28.sp)
.color(Color(0xFF5096F1)) .color(Color(0xFF5096F1))

@ -1,6 +1,7 @@
import 'package:aku_new_community/pages/sign/login/forgot_set_psd_page.dart'; import 'package:aku_new_community/pages/sign/login/forgot_set_psd_page.dart';
import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart'; import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart';
import 'package:aku_new_community/pages/sign/widget/tel_text_field.dart'; import 'package:aku_new_community/pages/sign/widget/tel_text_field.dart';
import 'package:aku_new_community/provider/clock_timer_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -8,6 +9,7 @@ import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../sign_func.dart'; import '../sign_func.dart';
@ -30,6 +32,7 @@ class _ForgotPsdPageState extends State<ForgotPsdPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ClockTimerProvider clockTimer = Provider.of<ClockTimerProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '', title: '',
bodyColor: Colors.white, bodyColor: Colors.white,
@ -83,7 +86,7 @@ class _ForgotPsdPageState extends State<ForgotPsdPage> {
Get.to(() => ForgotSetPsdPage( Get.to(() => ForgotSetPsdPage(
tel: _telController.text, tel: _telController.text,
)); ));
UserTool.appProvider.startTimer(); clockTimer.startTimer();
} else { } else {
BotToast.showText(text: base.msg); BotToast.showText(text: base.msg);
} }

@ -3,6 +3,7 @@ import 'package:aku_new_community/pages/sign/login/psd_verify.dart';
import 'package:aku_new_community/pages/sign/sign_func.dart'; import 'package:aku_new_community/pages/sign/sign_func.dart';
import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart'; import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart';
import 'package:aku_new_community/pages/sign/widget/psd_text_field.dart'; import 'package:aku_new_community/pages/sign/widget/psd_text_field.dart';
import 'package:aku_new_community/provider/clock_timer_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -10,6 +11,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class ForgotSetPsdPage extends StatefulWidget { class ForgotSetPsdPage extends StatefulWidget {
@ -52,6 +54,7 @@ class _ForgotSetPsdPageState extends State<ForgotSetPsdPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ClockTimerProvider clockTimer = Provider.of<ClockTimerProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '', title: '',
bodyColor: Colors.white, bodyColor: Colors.white,
@ -129,7 +132,7 @@ class _ForgotSetPsdPageState extends State<ForgotSetPsdPage> {
Get.to(() => ForgotSetPsdPage( Get.to(() => ForgotSetPsdPage(
tel: widget.tel, tel: widget.tel,
)); ));
UserTool.appProvider.startTimer(); clockTimer.startTimer();
} else { } else {
BotToast.showText(text: base.msg); BotToast.showText(text: base.msg);
} }
@ -137,7 +140,7 @@ class _ForgotSetPsdPageState extends State<ForgotSetPsdPage> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
'${UserTool.appProvider.second < 60 ? '${UserTool.appProvider.second}秒后重新获取' : '获取验证码'}' '${clockTimer.second < 60 ? '${clockTimer.second}秒后重新获取' : '获取验证码'}'
.text .text
.size(28.sp) .size(28.sp)
.color(Color(0xFF5096F1)) .color(Color(0xFF5096F1))

@ -6,6 +6,7 @@ import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart';
import 'package:aku_new_community/pages/sign/widget/psd_text_field.dart'; import 'package:aku_new_community/pages/sign/widget/psd_text_field.dart';
import 'package:aku_new_community/pages/sign/widget/tel_text_field.dart'; import 'package:aku_new_community/pages/sign/widget/tel_text_field.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/clock_timer_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -153,7 +154,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
} }
Widget _verificationView() { Widget _verificationView() {
AppProvider appProvider = Provider.of<AppProvider>(context); ClockTimerProvider clockTimer = Provider.of<ClockTimerProvider>(context);
return ListView( return ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [ children: [
@ -170,7 +171,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
), ),
100.w.heightBox, 100.w.heightBox,
LoginButtonWidget( LoginButtonWidget(
onTap: UserTool.appProvider.second < 60 onTap: clockTimer.second < 60
? () {} ? () {}
: () async { : () async {
var check = checkInput(); var check = checkInput();
@ -183,13 +184,13 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.communityModel!.id); .communityModel!.id);
if (base.success) { if (base.success) {
Get.to(() => CodeMessagePage(tel: _tel.text)); Get.to(() => CodeMessagePage(tel: _tel.text));
appProvider.startTimer(); clockTimer.startTimer();
} else { } else {
BotToast.showText(text: base.msg); BotToast.showText(text: base.msg);
} }
}, },
text: appProvider.timerStart text: clockTimer.timerStart
? '${appProvider.second}秒后重新获取' ? '${clockTimer.second}秒后重新获取'
: '获取验证码'), : '获取验证码'),
24.w.heightBox, 24.w.heightBox,
Row( Row(

@ -355,30 +355,7 @@ class AppProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
///
int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}
notifyListeners(); notifyListeners();
} }

@ -0,0 +1,30 @@
import 'dart:async';
import 'package:flutter/material.dart';
class ClockTimerProvider extends ChangeNotifier{
///
int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}
}

@ -9,9 +9,15 @@ class BeeCheckRadio<T> extends StatefulWidget {
final List<T>? groupValue; final List<T>? groupValue;
final Widget? indent; final Widget? indent;
final Color? backColor; final Color? backColor;
final double? size;
BeeCheckRadio( BeeCheckRadio(
{Key? key, this.value, this.groupValue, this.indent, this.backColor}) {Key? key,
this.value,
this.groupValue,
this.indent,
this.backColor,
this.size})
: super(key: key); : super(key: key);
@override @override
@ -30,8 +36,8 @@ class _BeeCheckRadioState extends State<BeeCheckRadio> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AnimatedContainer( return AnimatedContainer(
height: 40.w, height: widget.size ?? 40.w,
width: 40.w, width: widget.size ?? 40.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.backColor ?? kPrimaryColor.withOpacity(_selected ? 1 : 0), color: widget.backColor ?? kPrimaryColor.withOpacity(_selected ? 1 : 0),
border: Border.all( border: Border.all(
@ -40,7 +46,7 @@ class _BeeCheckRadioState extends State<BeeCheckRadio> {
: (_selected ? kPrimaryColor : Color(0xFF979797)), : (_selected ? kPrimaryColor : Color(0xFF979797)),
width: 3.w, width: 3.w,
), ),
borderRadius: BorderRadius.circular(20.w), borderRadius: BorderRadius.circular((widget.size??40.w)/2),
), ),
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,

@ -8,13 +8,14 @@ class BeeLongButton extends StatelessWidget {
final String text; final String text;
final Color backColor; final Color backColor;
final BorderSide border; final BorderSide border;
final double? width;
const BeeLongButton({Key? key, required this.onPressed, required this.text}) const BeeLongButton({Key? key, required this.onPressed, required this.text, this.width})
: backColor = kPrimaryColor, : backColor = kPrimaryColor,
border = BorderSide.none, border = BorderSide.none,
super(key: key); super(key: key);
BeeLongButton.white({Key? key, required this.onPressed, required this.text}) BeeLongButton.white({Key? key, required this.onPressed, required this.text, this.width})
: backColor = Colors.white, : backColor = Colors.white,
border = BorderSide(color: Colors.black.withOpacity(0.45)), border = BorderSide(color: Colors.black.withOpacity(0.45)),
super(key: key); super(key: key);
@ -24,6 +25,7 @@ class BeeLongButton extends StatelessWidget {
return MaterialButton( return MaterialButton(
elevation: 0, elevation: 0,
height: 93.w, height: 93.w,
minWidth: width,
disabledColor: Colors.black.withOpacity(0.06), disabledColor: Colors.black.withOpacity(0.06),
disabledTextColor: Colors.black.withOpacity(0.25), disabledTextColor: Colors.black.withOpacity(0.25),
textColor: Colors.black.withOpacity(0.85), textColor: Colors.black.withOpacity(0.85),

@ -1,3 +1,4 @@
import 'package:aku_new_community/widget/picker/bee_month_pick_body.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -7,8 +8,7 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/widget/picker/bee_custom_picker.dart'; import 'package:aku_new_community/widget/picker/bee_custom_picker.dart';
class BeeDatePicker { class BeeDatePicker {
static Future<DateTime?> pick( static Future<DateTime?> pick(DateTime initDate, {
DateTime initDate, {
CupertinoDatePickerMode mode = CupertinoDatePickerMode.date, CupertinoDatePickerMode mode = CupertinoDatePickerMode.date,
DateTime? min, DateTime? min,
DateTime? max, DateTime? max,
@ -29,6 +29,12 @@ class BeeDatePicker {
mode: CupertinoDatePickerMode.dateAndTime, mode: CupertinoDatePickerMode.dateAndTime,
)); ));
} }
static Future<DateTime?> monthPicker(DateTime initDate) async {
return await Get.bottomSheet(
BeeMonthPickBody(initTime: initDate)
);
}
} }
class _BeeDatePicker extends StatefulWidget { class _BeeDatePicker extends StatefulWidget {

@ -0,0 +1,111 @@
import 'package:aku_new_community/saas_model/login/china_region_model.dart';
import 'package:aku_new_community/saas_model/login/picked_city_model.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'bee_picker_box.dart';
class BeeMonthPickBody extends StatefulWidget {
final DateTime initTime;
BeeMonthPickBody({Key? key, required this.initTime}) : super(key: key);
@override
_BeeMonthPickBodyState createState() => _BeeMonthPickBodyState();
}
class _BeeMonthPickBodyState extends State<BeeMonthPickBody> {
final FixedExtentScrollController _yearController =
FixedExtentScrollController();
final FixedExtentScrollController _monthController =
FixedExtentScrollController();
DateTime get _pickedTime => DateTime(_pickYear,_pickMonth) ;
List<int> get _years => List.generate(
DateTime.now().year - widget.initTime.year+1,
(index) => widget.initTime.year + index);
late int _pickYear;
late int _pickMonth;
List<int> get _months => List.generate(
_pickYear == DateTime.now().year ? DateTime.now().month : 12,
(index) => index + 1);
@override
void initState() {
_pickYear = widget.initTime.year;
_pickMonth = 1;
super.initState();
}
@override
void dispose() {
_yearController.dispose();
_monthController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeePickerBox(
onPressed: () {
Navigator.pop(context, _pickedTime);
},
child: Row(
children: [
Expanded(
child: CupertinoPicker(
itemExtent: 80.w,
magnification: 1.0,
looping: false,
scrollController: _yearController,
onSelectedItemChanged: (index) {
_pickYear = _years[index];
_pickMonth = 1;
setState(() {});
},
children: _years
.map((e) => Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child:
Text(e.toString()+'', textAlign: TextAlign.center),
),
))
.toList()),
),
Expanded(
child: CupertinoPicker(
itemExtent: 80.w,
magnification: 1.0,
// offAxisFraction: 0.6,
looping: true,
scrollController: _monthController,
onSelectedItemChanged: (index) {
_pickMonth = _months[index];
setState(() {});
},
children: _months.isEmpty
? [Container()]
: _months
.map((e) => Center(
child: Padding(
padding: EdgeInsets.only(
left: 20.w,
right: 20.w,
top: 10.w,
bottom: 10.w),
child: Text(e.toString()+'',
textAlign: TextAlign.center),
),
))
.toList(),
),
),
],
),
);
}
}

File diff suppressed because it is too large Load Diff

@ -1,19 +1,19 @@
class Config { class Config {
/// ///
static const String homeDir = 'G:\\apk'; static const String homeDir = '/users/zhangmeng';
/// ///
static const String packageName = 'aku_new_community'; static const String packageName = 'aku_new_community';
/// ///
static String get buildPath => static String get buildPath =>
'\\build\\app\\outputs\\flutter-apk\\app-release.apk'; './build/app/outputs/flutter-apk/app-release.apk';
/// ///
static String get apkDevDir => static String get apkDevDir =>
'$homeDir\\aku_new_community\\dev'; '$homeDir/team/bee/aku_new_community_manager/dev';
/// ///
static String get apkDir => static String get apkDir =>
'$homeDir\\aku_new_community\\release'; '$homeDir/team/bee/aku_new_community_manager/release';
} }

Loading…
Cancel
Save