Skip to content

Commit

Permalink
升级flutter到最新3.22.1 dart 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy1003 committed May 28, 2024
1 parent 9065306 commit 4f38547
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 128 deletions.
6 changes: 3 additions & 3 deletions lib/me/cash/cash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class _CashPageState extends State<CashPage> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(extractIntervalDesc, style: Theme.of(context).textTheme.subtitle2),
Text(extractIntervalDesc, style: Theme.of(context).textTheme.titleSmall),
GestureDetector(
child: SizedBox(
height: 48.0,
Expand Down Expand Up @@ -379,7 +379,7 @@ class _CashPageState extends State<CashPage> {
child: RichText(
text: TextSpan(
text: '预计',
style: Theme.of(context).textTheme.bodyText2?.copyWith(fontSize: 12),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 12),
children: <TextSpan>[
TextSpan(text: extractFeeDesc, style: TextStyle(color: Color(0xFFFF8547))),
],
Expand Down Expand Up @@ -442,7 +442,7 @@ class _CashPageState extends State<CashPage> {
child: RichText(
text: TextSpan(
text: '预计',
style: Theme.of(context).textTheme.bodyText2?.copyWith(fontSize: 12),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 12),
children: <TextSpan>[
TextSpan(text: extractFeeDesc, style: TextStyle(color: Color(0xFFFF8547))),
],
Expand Down
4 changes: 2 additions & 2 deletions lib/me/cash/cash_record_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class _CashRecordListPageState extends State<CashRecordListPage> {
bottom: 0.0,
left: 0.0,
child: Text(createTime.split(' ').last,
style: Theme.of(context).textTheme.subtitle2),
style: Theme.of(context).textTheme.titleSmall),
),
Positioned(
bottom: 0.0,
Expand All @@ -116,7 +116,7 @@ class _CashRecordListPageState extends State<CashRecordListPage> {
style: record['status'] == 1
? TextStyle(
fontSize: 12,
color: Theme.of(context).errorColor,
color: Theme.of(context).colorScheme.error,
)
: const TextStyle(
fontSize: 12,
Expand Down
4 changes: 2 additions & 2 deletions lib/me/cash/cash_result_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class _CashResultPageState extends State<CashResultPage> {
PWidget.boxh(8),
Text(
'2021-02-21 15:20:10',
style: Theme.of(context).textTheme.subtitle2,
style: Theme.of(context).textTheme.titleSmall,
),
PWidget.boxh(8),
Text(
'5秒后返回提现页面',
style: Theme.of(context).textTheme.subtitle2,
style: Theme.of(context).textTheme.titleSmall,
),
PWidget.boxh(24),
MyButton(
Expand Down
2 changes: 1 addition & 1 deletion lib/me/cash/widgets/click_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ClickItem extends StatelessWidget {
maxLines: maxLines,
textAlign: maxLines == 1 ? TextAlign.right : textAlign,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.subtitle2?.copyWith(fontSize: Dimens.font_sp14),
style: Theme.of(context).textTheme.titleSmall?.copyWith(fontSize: Dimens.font_sp14),
),
),
PWidget.boxw(8),
Expand Down
8 changes: 4 additions & 4 deletions lib/me/select_text_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class SelectTextItem extends StatelessWidget {
Key? key,
this.onTap,
this.title,
this.content: "",
this.content= "",
this.contentWidget,
this.textAlign: TextAlign.end,
this.textAlign= TextAlign.end,
this.style,
this.leading,
this.subTitle: "",
this.height: 55.0,
this.subTitle= "",
this.height= 55.0,
this.trailing,
this.margin,
this.bgColor,
Expand Down
14 changes: 7 additions & 7 deletions lib/me/styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import '../util/dimens.dart';

class TextStyles {
static TextStyle textStyle(
{double fontSize: Dimens.font_sp12,
Color color: Colors.white,
{double fontSize= Dimens.font_sp12,
Color color= Colors.white,
FontWeight? fontWeight}) {
return TextStyle(
fontSize: fontSize,
Expand Down Expand Up @@ -47,11 +47,11 @@ class TextStyles {
static TextStyle nowMoneyBlack = ts(color: Colors.black, fontSize: 32.0,
fontWeight: FontWeight.bold, fontFamily: 'headlinea');
static TextStyle ts(
{double fontSize: Dimens.font_sp14,
Color color: Colors.white,
FontWeight fontWeight: FontWeight.bold,
TextDecoration decoration: TextDecoration.none,
String fontFamily: 'headlinea'}) {
{double fontSize= Dimens.font_sp14,
Color color= Colors.white,
FontWeight fontWeight= FontWeight.bold,
TextDecoration decoration= TextDecoration.none,
String fontFamily= 'headlinea'}) {
return TextStyle(
color: color,
fontSize: fontSize,
Expand Down
15 changes: 5 additions & 10 deletions lib/pay/ios_payment_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ class IOSPaymentState extends State {
icon: const Icon(Icons.upgrade))
: TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.green[800],
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: Colors.white,
foregroundColor: Colors.white, backgroundColor: Colors.green[800],
),
onPressed: () {
//todo 调用接口预创建订单 返回orderId
Expand Down Expand Up @@ -331,10 +328,7 @@ class IOSPaymentState extends State {
children: <Widget>[
TextButton(
style: TextButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: Colors.white,
foregroundColor: Colors.white, backgroundColor: Theme.of(context).primaryColor,
),
onPressed: () => _inAppPurchase.restorePurchases(),
child: const Text('Restore purchases'),
Expand Down Expand Up @@ -375,13 +369,14 @@ class IOSPaymentState extends State {
}

Future<bool> _verifyPurchase(PurchaseDetails purchaseDetails) async {
//todo 调用后台验证
//调用后台验证
AppStorePurchaseDetails details = purchaseDetails as AppStorePurchaseDetails;
String? orderId = details.skPaymentTransaction.payment.applicationUsername;
// var data1 = await BService.verifyIOS(details.verificationData.localVerificationData);

Map data = await BService.payNotifyIOS(orderId, purchaseDetails.verificationData.serverVerificationData);
return data['success'];
//todo 调用后台验证
//调用后台验证
// IMPORTANT!! Always verify a purchase before delivering the product.
// For the purpose of an example, we directly return true.
// return Future<bool>.value(true);
Expand Down
68 changes: 0 additions & 68 deletions lib/util/picker_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,74 +15,6 @@ class PickerHelper {

static final textDarkGrayColor = Color.fromRGBO(64, 64, 64, 1.0);

///普通简易选择器
static void openSimpleDataPicker<T>(
BuildContext context, {
required List<T> list,
required String title,
required T value,
PickerDataAdapter? adapter,
required PickerConfirmCallback onConfirm,
}) {
var incomeIndex = 0;
if (list != null) {
for (int i = 0; i < list.length; i++) {
if (list[i] == value) {
incomeIndex = i;
break;
}
}
}
openModalPicker(context,
adapter: adapter ??
PickerDataAdapter(
pickerData: list,
isArray: false,
),
onConfirm: onConfirm,
selecteds: [incomeIndex],
title: title);
}

///数字选择器
static void openNumberPicker(
BuildContext context, {
required String title,
required List<NumberPickerColumn> datas,
NumberPickerAdapter? adapter,
required PickerConfirmCallback onConfirm,
}) {
openModalPicker(context,
adapter: adapter ?? NumberPickerAdapter(data: datas),
title: title,
onConfirm: onConfirm);
}

///日期选择器
static void openDateTimePicker(
BuildContext context, {
required String title,
required DateTime maxValue,
required DateTime minValue,
DateTime? value,
DateTimePickerAdapter? adapter,
required PickerConfirmCallback onConfirm,
}) {
openModalPicker(context,
adapter: adapter ??
DateTimePickerAdapter(
type: PickerDateTimeType.kYMD,
isNumberMonth: true,
yearSuffix: "年",
maxValue: maxValue,
minValue: minValue,
value: value ?? DateTime.now(),
monthSuffix: "月",
daySuffix: "日"),
title: title,
onConfirm: onConfirm);
}

///地址选择器
static void openCityPicker(BuildContext context, List cityList,
{required String title,
Expand Down
2 changes: 1 addition & 1 deletion lib/util/saveNetWorkImages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class saveNetWorkImages {
/// 保存图片到相册
///
/// 默认为下载网络图片,如需下载资源图片,需要指定 [isAsset]`true`
static Future<void> saveImage(String imageUrl, {bool isAsset: false}) async {
static Future<void> saveImage(String imageUrl, {bool isAsset= false}) async {
try {
if (imageUrl == null) throw '保存失败,图片不存在!';

Expand Down
20 changes: 7 additions & 13 deletions lib/webview/custom_webview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,13 @@ class _CustomWebViewState extends State<CustomWebView> {
InAppWebView(
key: webViewKey,
initialUrlRequest:
URLRequest(url: Uri.parse(widget.data['url'])),
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false,
),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
//开启混合模式
mixedContentMode: AndroidMixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
)),
URLRequest(url: WebUri(widget.data['url'])),
initialSettings: InAppWebViewSettings(
mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW,
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false,
allowsInlineMediaPlayback: true
),
pullToRefreshController: refresh ? pullToRefreshController : null,
onWebViewCreated: (controller) {
webViewController = controller;
Expand Down
22 changes: 8 additions & 14 deletions lib/webview/pay_webview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,14 @@ class _PayWebViewState extends State<PayWebView> with WidgetsBindingObserver {
Widget createWebview(refresh) {
return InAppWebView(
key: webViewKey,
initialUrlRequest: URLRequest(url: Uri.parse(widget.data['url'])),
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false,
),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
//开启混合模式
mixedContentMode:
AndroidMixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
)),
initialUrlRequest: URLRequest(url: WebUri((widget.data['url']))),
initialSettings: InAppWebViewSettings(
mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW,
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false,
allowsInlineMediaPlayback: true

),
pullToRefreshController: refresh ? pullToRefreshController : null,
onWebViewCreated: (controller) {
webViewController = controller;
Expand Down
15 changes: 14 additions & 1 deletion lib/widget/CustomWidgetPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Widget rainbowText(String text, {onTap, colors, fontSize = 14.0, fontWeight = Fo
));
}

Widget shimmerWidget(Widget child, {color: Colors.red, highlightColor: Colors.yellow}) {
Widget shimmerWidget(Widget child, {color= Colors.red, highlightColor= Colors.yellow}) {
return Shimmer.fromColors(
baseColor: color,
highlightColor: highlightColor,
Expand Down Expand Up @@ -493,4 +493,17 @@ Widget getBuyTipWidget({color = Colors.red}) {
),
{'pd': [8,12,12,8]},
);
}


Widget btmBtnView(name, icon, fun, collect) {
return PWidget.column(
[
PWidget.icon(icon ?? Icons.star_rate_rounded, PFun.lg1(Colours.getCollectColor(name, collect))),
PWidget.boxh(4),
PWidget.textNormal(name ?? '收藏', [Colors.black45, 12])
],
'220',
{'fun': fun},
);
}
7 changes: 5 additions & 2 deletions lib/widget/auth_tip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:shake_animation_widget/shake_animation_widget.dart';
import '../service.dart';


abstract class AuthTip{
mixin class AuthTip<T>{
ShakeAnimationController _shakeAnimationController = new ShakeAnimationController();
Timer? timer;
late bool showChannelWidget = false;
Expand Down Expand Up @@ -56,7 +56,10 @@ abstract class AuthTip{
}
}

tipClick();
tipClick() {
// TODO: implement tipClick
throw UnimplementedError();
}

Widget createChannelAuthWidget(img) {
return PWidget.positioned(
Expand Down
2 changes: 2 additions & 0 deletions lib/widget/custom_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class CustomButton extends StatelessWidget {
border: Border.all(width: 1, color: textColor??_contrastColor),
borderRadius: borderRadius,
);
case CustomButtonStyle.wechat:
// TODO: Handle this case.
}
}

Expand Down
2 changes: 2 additions & 0 deletions lib/widget/order_tab_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class _OrderTabWidgetState extends State<OrderTabWidget> with TickerProviderStat
width: double.infinity,
alignment: Alignment.center,
child: TabBar(
dividerHeight: 0,
tabAlignment: TabAlignment.start,
controller: tabCon,
physics: MyBouncingScrollPhysics(),
indicatorSize: TabBarIndicatorSize.label,
Expand Down
2 changes: 2 additions & 0 deletions lib/widget/tab_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class _TabWidgetState extends State<TabWidget> with TickerProviderStateMixin {
// ),
// ),
child: TabBar(
dividerHeight: 0,
tabAlignment: TabAlignment.start,
controller: tabCon,
physics: MyBouncingScrollPhysics(),
indicatorSize: TabBarIndicatorSize.label,
Expand Down

0 comments on commit 4f38547

Please sign in to comment.