diff --git a/android/app/src/main/kotlin/com/xdag/io/MainActivity.kt b/android/app/src/main/kotlin/com/xdag/io/MainActivity.kt
index 7d6c274..bc1c19b 100644
--- a/android/app/src/main/kotlin/com/xdag/io/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/xdag/io/MainActivity.kt
@@ -1,6 +1,47 @@
package com.xdag.io
-import io.flutter.embedding.android.FlutterActivity
+import android.os.Build
+import android.os.Bundle
+import androidx.activity.OnBackPressedCallback
import io.flutter.embedding.android.FlutterFragmentActivity
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugins.GeneratedPluginRegistrant
+
class MainActivity: FlutterFragmentActivity() {
+ private lateinit var onBackPressedCallback: OnBackPressedCallback
+ override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
+ GeneratedPluginRegistrant.registerWith(flutterEngine)
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ // android 33
+ if (Build.VERSION.SDK_INT >= 33) {
+ onBackPressedCallback = object : OnBackPressedCallback(true) {
+ override fun handleOnBackPressed() {
+ // flutter 侧处理返回事件
+ flutterEngine!!.navigationChannel.popRoute()
+ }
+ }
+ // 注册 OnBackPressedCallback
+ val onBackPressedDispatcher = onBackPressedDispatcher
+ onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ if (Build.VERSION.SDK_INT >= 33) {
+ onBackPressedCallback.remove()
+ }
+ }
+
+ override fun onBackPressed() {
+// super.onBackPressed()
+ if (Build.VERSION.SDK_INT < 33) {
+ flutterEngine!!.navigationChannel.popRoute();
+ }
+ }
+
+
}
diff --git a/android/app/src/main/res/drawable/change.xml b/android/app/src/main/res/drawable/change.xml
new file mode 100644
index 0000000..3c9e150
--- /dev/null
+++ b/android/app/src/main/res/drawable/change.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/lib/common/global.dart b/lib/common/global.dart
index dc408a2..10b7303 100644
--- a/lib/common/global.dart
+++ b/lib/common/global.dart
@@ -68,7 +68,10 @@ class Global {
];
if (contactsList != null) {
for (var item in contactsList) {
- contactsListBox.add(ContactsItem.fromJson(item));
+ ContactsItem ele = ContactsItem.fromJson(item);
+ if (ele.address != '4duPWMbYUgAifVYkKDCWxLvRRkSByf5gb') {
+ contactsListBox.add(ele);
+ }
}
}
PackageInfo packageInfo = await PackageInfo.fromPlatform();
diff --git a/lib/common/helper.dart b/lib/common/helper.dart
index 21d1e29..96ca82c 100644
--- a/lib/common/helper.dart
+++ b/lib/common/helper.dart
@@ -1,10 +1,13 @@
import 'dart:io';
+import 'package:chinese_font_library/chinese_font_library.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_statusbarcolor_ns/flutter_statusbarcolor_ns.dart';
import 'package:hex/hex.dart';
import 'package:pointycastle/export.dart';
+import 'package:provider/provider.dart';
import 'package:xdag/common/color.dart';
+import 'package:xdag/model/config_modal.dart';
import 'package:xdag/widget/button.dart';
import 'dart:typed_data';
import 'package:bip32/bip32.dart' as bip32;
@@ -13,12 +16,9 @@ import 'package:fast_base58/fast_base58.dart';
import 'package:xdag/widget/desktop.dart';
class Helper {
- static final GlobalKey scaffoldMessengerKey = GlobalKey();
static bool isDesktop = Platform.isLinux || Platform.isMacOS || Platform.isWindows;
static bool checkName(String name) {
- // RegExp regExp = RegExp(r"^[a-zA-Z0-9\u4e00-\u9fa5]+$");
RegExp regExp2 = RegExp(r",");
- // print(regExp2.hasMatch(name));
return !regExp2.hasMatch(name);
}
@@ -71,6 +71,14 @@ class Helper {
return result;
}
+ static TextStyle fitChineseFont(BuildContext context, TextStyle textStyle, {listen = true}) {
+ ConfigModal configModal = Provider.of(context, listen: listen);
+ if (configModal.local == const Locale("ja") || configModal.local == const Locale("zh")) {
+ return textStyle.useSystemChineseFont();
+ }
+ return textStyle;
+ }
+
// show toast
static void showToast(BuildContext context, String msg) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
@@ -80,18 +88,11 @@ class Helper {
duration: const Duration(seconds: 1),
content: Text(
msg,
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white),
- ),
- ));
- }
-
- static void showSnackBar(String msg) {
- scaffoldMessengerKey.currentState?.showSnackBar(SnackBar(
- backgroundColor: DarkColors.mainColor,
- behavior: SnackBarBehavior.floating,
- content: Text(
- msg,
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white),
+ style: Helper.fitChineseFont(
+ context,
+ const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white),
+ listen: false,
+ ),
),
));
}
@@ -127,7 +128,7 @@ class Helper {
child: Center(
child: Text(
title,
- style: const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700)),
),
)),
const SizedBox(width: 40)
diff --git a/lib/main.dart b/lib/main.dart
index b40c96c..c18db5b 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -84,7 +84,6 @@ class MyWidget extends StatelessWidget {
supportedLocales: AppLocalizations.supportedLocales,
locale: configModal.local,
theme: ThemeData(
- // 日文,中文使用系统默认字体
fontFamily: configModal.local == const Locale("ja") || configModal.local == const Locale("zh") ? "system-font" : "RobotoMono",
scrollbarTheme: !Helper.isDesktop
? null
diff --git a/lib/model/contacts_modal.dart b/lib/model/contacts_modal.dart
index e501b19..ed418b0 100644
--- a/lib/model/contacts_modal.dart
+++ b/lib/model/contacts_modal.dart
@@ -22,7 +22,9 @@ class ContactsModal extends ChangeNotifier {
updateList() async {
List list = [];
for (var i in Global.contactsListBox) {
- list.add(i.toJsonString());
+ if (i.address != '4duPWMbYUgAifVYkKDCWxLvRRkSByf5gb') {
+ list.add(i.toJsonString());
+ }
}
await Global.prefs.setStringList(Global.contactsListKey, list);
notifyListeners();
@@ -32,7 +34,7 @@ class ContactsModal extends ChangeNotifier {
try {
ContactsItem item = ContactsItem(name, address);
// 插入到第一个
- Global.contactsListBox.insert(0, item);
+ Global.contactsListBox.insert(1, item);
updateList();
} catch (e) {
rethrow;
diff --git a/lib/page/common/add_contacts_page.dart b/lib/page/common/add_contacts_page.dart
index fc84c16..7fab553 100644
--- a/lib/page/common/add_contacts_page.dart
+++ b/lib/page/common/add_contacts_page.dart
@@ -125,7 +125,7 @@ class _AddContactsPage extends State {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(AppLocalizations.of(context).contact_name, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(AppLocalizations.of(context).contact_name, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 13),
AutoSizeTextField(
controller: controller2,
@@ -147,18 +147,13 @@ class _AddContactsPage extends State {
},
textInputAction: TextInputAction.next,
keyboardAppearance: Brightness.dark,
- style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
filled: true,
contentPadding: const EdgeInsets.all(15),
fillColor: DarkColors.blockColor,
hintText: AppLocalizations.of(context).contact_name,
- hintStyle: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white54,
- ),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(10)),
@@ -170,7 +165,7 @@ class _AddContactsPage extends State {
),
),
const SizedBox(height: 25),
- Text(AppLocalizations.of(context).walletAddress, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(AppLocalizations.of(context).walletAddress, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 13),
AutoSizeTextField(
controller: controller,
@@ -192,22 +187,13 @@ class _AddContactsPage extends State {
},
textInputAction: TextInputAction.next,
keyboardAppearance: Brightness.dark,
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
filled: true,
contentPadding: const EdgeInsets.all(15),
fillColor: DarkColors.blockColor,
hintText: AppLocalizations.of(context).walletAddress,
- hintStyle: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white54,
- ),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(10)),
@@ -227,7 +213,7 @@ class _AddContactsPage extends State {
color: DarkColors.redColorMask,
borderRadius: BorderRadius.circular(10),
),
- child: Text(error, style: const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500)),
+ child: Text(error, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500))),
)
else
const SizedBox(height: 20),
diff --git a/lib/page/common/back_up_page.dart b/lib/page/common/back_up_page.dart
index 7695ae7..faeb3a8 100644
--- a/lib/page/common/back_up_page.dart
+++ b/lib/page/common/back_up_page.dart
@@ -56,11 +56,11 @@ class BackUpPage extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(15, 30, 15, 0),
child: Column(
children: [
- Text(args.type == 0 ? AppLocalizations.of(context).write_Down_Mnemonics : AppLocalizations.of(context).write_Down_PrivateKey, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: DarkColors.mainColor)),
+ Text(args.type == 0 ? AppLocalizations.of(context).write_Down_Mnemonics : AppLocalizations.of(context).write_Down_PrivateKey, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: DarkColors.mainColor))),
const SizedBox(height: 15),
Text(
args.isBackup ? AppLocalizations.of(context).backup_test_tips_3 : (args.type == 0 ? AppLocalizations.of(context).write_Down_Mnemonics_tips : AppLocalizations.of(context).write_Down_PrivateKey_tips),
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white)),
),
const SizedBox(height: 20),
Container(
@@ -72,7 +72,7 @@ class BackUpPage extends StatelessWidget {
),
// 每两个元素一行
child: args.type == 1
- ? Text(args.data, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))
+ ? Text(args.data, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)))
: Wrap(
spacing: 20,
runSpacing: 20,
@@ -85,7 +85,7 @@ class BackUpPage extends StatelessWidget {
borderRadius: BorderRadius.circular(25),
),
child: Center(
- child: Text('${e.index}. ${e.value}', style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
+ child: Text('${e.index}. ${e.value}', style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
)))
.toList(),
),
diff --git a/lib/page/common/back_up_test_page.dart b/lib/page/common/back_up_test_page.dart
index b4fd1ec..fca5c4f 100644
--- a/lib/page/common/back_up_test_page.dart
+++ b/lib/page/common/back_up_test_page.dart
@@ -36,13 +36,13 @@ class BackUpStartPage extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(15, 30, 15, 30),
child: Column(
children: [
- Text(AppLocalizations.of(context).secure_wallet, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: DarkColors.mainColor)),
+ Text(AppLocalizations.of(context).secure_wallet, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: DarkColors.mainColor))),
const SizedBox(height: 50),
Expanded(child: Image.asset('images/lock.png', fit: BoxFit.contain)),
const SizedBox(height: 50),
- Text(AppLocalizations.of(context).write_Down_Mnemonics_tips, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(AppLocalizations.of(context).write_Down_Mnemonics_tips, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 12),
- Text(AppLocalizations.of(context).backup_test_tips_2, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(AppLocalizations.of(context).backup_test_tips_2, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white))),
],
),
),
@@ -126,6 +126,13 @@ class _BackUpTestPageState extends State {
}
void getMnemonicList(String value) {
+ if (value.endsWith(" ")) {
+ setState(() {
+ mnemonicList = [];
+ errorText = "";
+ });
+ return;
+ }
List list = value.trim().split(" ");
setState(() {
mnemonicNumber = value.isEmpty ? 0 : list.length;
@@ -184,11 +191,11 @@ class _BackUpTestPageState extends State {
padding: const EdgeInsets.fromLTRB(15, 30, 15, 0),
child: Column(
children: [
- Text(AppLocalizations.of(context).confirm_Mnemonic, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: DarkColors.mainColor)),
+ Text(AppLocalizations.of(context).confirm_Mnemonic, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: DarkColors.mainColor))),
const SizedBox(height: 15),
Text(
AppLocalizations.of(context).mnemonic_hint_2,
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white)),
),
const SizedBox(height: 20),
AutoSizeTextField(
@@ -213,22 +220,13 @@ class _BackUpTestPageState extends State {
);
},
textInputAction: TextInputAction.done,
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
filled: true,
contentPadding: const EdgeInsets.all(15),
fillColor: DarkColors.blockColor,
hintText: AppLocalizations.of(context).mnemonic,
- hintStyle: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white54,
- ),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(10)),
@@ -243,7 +241,7 @@ class _BackUpTestPageState extends State {
Row(
children: [
const Spacer(),
- Text('$mnemonicNumber ${mnemonicNumber > 1 ? AppLocalizations.of(context).words : AppLocalizations.of(context).word}', style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white54)),
+ Text('$mnemonicNumber ${mnemonicNumber > 1 ? AppLocalizations.of(context).words : AppLocalizations.of(context).word}', style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white54))),
],
),
if (errorText.isNotEmpty)
@@ -255,7 +253,7 @@ class _BackUpTestPageState extends State {
color: DarkColors.redColorMask,
borderRadius: BorderRadius.circular(10),
),
- child: Text(errorText, style: const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500)),
+ child: Text(errorText, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500))),
)
else
const SizedBox(),
@@ -292,7 +290,7 @@ class _BackUpTestPageState extends State {
mnemonicList = [];
});
},
- child: Text(word, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: DarkColors.mainColor)),
+ child: Text(word, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: DarkColors.mainColor))),
);
},
),
@@ -334,17 +332,17 @@ class _BackUpTestPageState extends State {
const SizedBox(height: 20),
Text(
AppLocalizations.of(context).successful,
- style: const TextStyle(color: DarkColors.mainColor, fontSize: 24.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: DarkColors.mainColor, fontSize: 24.0, fontWeight: FontWeight.w700)),
),
const SizedBox(height: 20),
Text(
AppLocalizations.of(context).backup_test_tips_4,
- style: const TextStyle(color: Colors.white, fontSize: 14.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 14.0, fontWeight: FontWeight.w500)),
),
const SizedBox(height: 10),
Text(
AppLocalizations.of(context).backup_test_tips_5,
- style: const TextStyle(color: Colors.white, fontSize: 14.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 14.0, fontWeight: FontWeight.w500)),
)
],
),
diff --git a/lib/page/common/change_name_page.dart b/lib/page/common/change_name_page.dart
index 0819326..b0f3214 100644
--- a/lib/page/common/change_name_page.dart
+++ b/lib/page/common/change_name_page.dart
@@ -44,7 +44,7 @@ class _ChangeNamePageState extends State {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(AppLocalizations.of(context).walletName, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(AppLocalizations.of(context).walletName, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 10),
Input(
defaultValue: wallet.name,
diff --git a/lib/page/common/check_page.dart b/lib/page/common/check_page.dart
index 28cbf29..cdc6973 100644
--- a/lib/page/common/check_page.dart
+++ b/lib/page/common/check_page.dart
@@ -100,7 +100,7 @@ class _CheckPageState extends State {
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Center(
- child: Text(AppLocalizations.of(context).use_password, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white)),
+ child: Text(AppLocalizations.of(context).use_password, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white))),
),
),
)
@@ -126,7 +126,7 @@ class _CheckPageState extends State {
children: [
if (type == 0) Image.asset('images/face_id.png') else Image.asset('images/biometrics.png'),
const SizedBox(height: 30),
- Text(tipsText, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white)),
+ Text(tipsText, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white))),
],
),
),
diff --git a/lib/page/common/create_wallet_page.dart b/lib/page/common/create_wallet_page.dart
index 23d035e..2ae099f 100644
--- a/lib/page/common/create_wallet_page.dart
+++ b/lib/page/common/create_wallet_page.dart
@@ -68,6 +68,13 @@ class _CreateWalletPageState extends State {
}
void getMnemonicList(String value) {
+ if (value.endsWith(" ")) {
+ setState(() {
+ mnemonicList = [];
+ errorText = "";
+ });
+ return;
+ }
List list = value.trim().split(" ");
setState(() {
mnemonicNumber = value.isEmpty ? 0 : list.length;
@@ -193,7 +200,7 @@ class _CreateWalletPageState extends State {
),
),
const SizedBox(height: 25),
- Text(isPrivateKey ? AppLocalizations.of(context).privateKey : AppLocalizations.of(context).mnemonic, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(isPrivateKey ? AppLocalizations.of(context).privateKey : AppLocalizations.of(context).mnemonic, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 10),
AutoSizeTextField(
controller: controller,
@@ -219,22 +226,13 @@ class _CreateWalletPageState extends State {
);
},
textInputAction: TextInputAction.next,
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
filled: true,
contentPadding: const EdgeInsets.all(15),
fillColor: DarkColors.blockColor,
hintText: isPrivateKey ? AppLocalizations.of(context).privateKey : AppLocalizations.of(context).mnemonic_hint_1,
- hintStyle: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white54,
- ),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(10)),
@@ -249,7 +247,7 @@ class _CreateWalletPageState extends State {
Row(
children: [
const Spacer(),
- Text('$mnemonicNumber ${mnemonicNumber > 1 ? AppLocalizations.of(context).words : AppLocalizations.of(context).word}', style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white54)),
+ Text('$mnemonicNumber ${mnemonicNumber > 1 ? AppLocalizations.of(context).words : AppLocalizations.of(context).word}', style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white54))),
],
),
if (errorText.isNotEmpty)
@@ -261,7 +259,7 @@ class _CreateWalletPageState extends State {
color: DarkColors.redColorMask,
borderRadius: BorderRadius.circular(10),
),
- child: Text(errorText, style: const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500)),
+ child: Text(errorText, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500))),
)
else
const SizedBox(),
@@ -270,7 +268,7 @@ class _CreateWalletPageState extends State {
)
else
Container(),
- Text(AppLocalizations.of(context).walletName, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(AppLocalizations.of(context).walletName, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 10),
Input(
isFocus: !args.isImport,
@@ -326,7 +324,7 @@ class _CreateWalletPageState extends State {
importContent = controller.text;
});
},
- child: Text(word, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: DarkColors.mainColor)),
+ child: Text(word, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: DarkColors.mainColor))),
);
},
),
@@ -384,7 +382,7 @@ class _CreateWalletPageState extends State {
behavior: SnackBarBehavior.fixed,
content: Text(
e.toString(),
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white), listen: false),
),
));
}
@@ -429,7 +427,7 @@ class HeaderItem extends StatelessWidget {
child: Text(
title,
textAlign: TextAlign.center,
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white)),
),
),
),
diff --git a/lib/page/common/face_id_page.dart b/lib/page/common/face_id_page.dart
index b3772d7..1453767 100644
--- a/lib/page/common/face_id_page.dart
+++ b/lib/page/common/face_id_page.dart
@@ -47,11 +47,6 @@ class FaceIDPage extends StatelessWidget {
if (ModalRoute.of(context)!.settings.arguments != null) {
args = ModalRoute.of(context)!.settings.arguments as FaceIDPageRouteParams;
}
- const descStyle = TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- );
ScreenHelper.initScreen(context);
// String tipsText = AppLocalizations.of(context).create_biometrics_tips_3;
String tipsText = args.type == 0 ? AppLocalizations.of(context).create_biometrics_tips_1 : AppLocalizations.of(context).create_biometrics_tips_2;
@@ -72,7 +67,7 @@ class FaceIDPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 20),
- Text(AppLocalizations.of(context).create_faceid_tips, style: descStyle),
+ Text(AppLocalizations.of(context).create_faceid_tips, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
Expanded(
child: MyCupertinoButton(
child: Column(
@@ -80,7 +75,7 @@ class FaceIDPage extends StatelessWidget {
children: [
if (args.type == 0) Image.asset('images/face_id.png') else Image.asset('images/biometrics.png'),
const SizedBox(height: 20),
- Text(tipsText, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white)),
+ Text(tipsText, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: Colors.white))),
],
),
onPressed: () => _authenticate(config, context, args)),
diff --git a/lib/page/common/langs_select.dart b/lib/page/common/langs_select.dart
index ab49b1a..86562fe 100644
--- a/lib/page/common/langs_select.dart
+++ b/lib/page/common/langs_select.dart
@@ -41,7 +41,7 @@ class LangsSelectPage extends StatelessWidget {
const SizedBox(width: 15),
Text(
index == 0 ? AppLocalizations.of(context).auto : item.name,
- style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w700)),
),
const Spacer(),
if (config.walletConfig.local == index) Image.asset('images/select.png', width: 20, height: 20) else const SizedBox(width: 20),
@@ -98,7 +98,7 @@ class NetWorkSelectPage extends StatelessWidget {
const SizedBox(width: 15),
Text(
item,
- style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w700)),
),
const Spacer(),
if (config.walletConfig.network == index) Image.asset('images/select.png', width: 20, height: 20) else const SizedBox(width: 20),
diff --git a/lib/page/common/legal_page.dart b/lib/page/common/legal_page.dart
index 08f7707..a1668f5 100644
--- a/lib/page/common/legal_page.dart
+++ b/lib/page/common/legal_page.dart
@@ -31,18 +31,12 @@ class LegalPage extends StatelessWidget {
args = ModalRoute.of(context)!.settings.arguments as LegalPageRouteParams;
}
double screenWidth = ScreenHelper.screenWidth;
- const descStyle = TextStyle(
- decoration: TextDecoration.none,
- fontSize: 14,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- );
Widget? header = args.isFromSetting
? const SizedBox(height: 30)
: Column(
children: [
const SizedBox(height: 40),
- Text(AppLocalizations.of(context).review_Privacy_Policy, style: descStyle),
+ Text(AppLocalizations.of(context).review_Privacy_Policy, style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 28),
],
);
diff --git a/lib/page/common/password_page.dart b/lib/page/common/password_page.dart
index 7f807ab..57e02fe 100644
--- a/lib/page/common/password_page.dart
+++ b/lib/page/common/password_page.dart
@@ -5,6 +5,7 @@ import 'package:provider/provider.dart';
import 'package:xdag/common/color.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:xdag/common/global.dart';
+import 'package:xdag/common/helper.dart';
import 'package:xdag/model/config_modal.dart';
import 'package:xdag/page/common/check_page.dart';
import 'package:xdag/page/common/security_page.dart';
@@ -79,10 +80,13 @@ class _PasswordPageState extends State {
behavior: SnackBarBehavior.fixed,
content: Text(
AppLocalizations.of(context).change_password_success,
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white),
+ style: Helper.fitChineseFont(
+ context,
+ const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white),
+ listen: false,
+ ),
),
));
- // Helper.showSnackBar(AppLocalizations.of(context).change_password_success);
},
),
);
diff --git a/lib/page/common/security_page.dart b/lib/page/common/security_page.dart
index b0ad4c4..6781085 100644
--- a/lib/page/common/security_page.dart
+++ b/lib/page/common/security_page.dart
@@ -21,11 +21,6 @@ class SecurityPage extends StatelessWidget {
if (ModalRoute.of(context)!.settings.arguments != null) {
args = ModalRoute.of(context)!.settings.arguments as SecurityPageRouteParams;
}
- const descStyle = TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- );
return Scaffold(
body: Column(
children: [
@@ -37,7 +32,7 @@ class SecurityPage extends StatelessWidget {
child: Column(
children: [
const SizedBox(height: 20),
- if (args.code.isNotEmpty || args.nextPage == 2) const SizedBox() else Text(AppLocalizations.of(context).create_password_tips, style: descStyle),
+ if (args.code.isNotEmpty || args.nextPage == 2) const SizedBox() else Text(AppLocalizations.of(context).create_password_tips, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white))),
Expanded(child: InputPassCode(code: args.code, nextPage: args.nextPage, checkCallback: args.checkCallback)),
],
),
diff --git a/lib/page/detail/contacts_page.dart b/lib/page/detail/contacts_page.dart
index 1c8066e..5ddb304 100644
--- a/lib/page/detail/contacts_page.dart
+++ b/lib/page/detail/contacts_page.dart
@@ -144,22 +144,13 @@ class ContactsStatePage extends State {
},
textInputAction: TextInputAction.next,
keyboardAppearance: Brightness.dark,
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
filled: true,
contentPadding: const EdgeInsets.all(15),
fillColor: DarkColors.blockColor,
hintText: AppLocalizations.of(context).walletAddress,
- hintStyle: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white54,
- ),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(10)),
@@ -179,7 +170,7 @@ class ContactsStatePage extends State {
color: DarkColors.redColorMask,
borderRadius: BorderRadius.circular(10),
),
- child: Text(error, style: const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500)),
+ child: Text(error, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500))),
)
else
const SizedBox(height: 0),
@@ -206,7 +197,7 @@ class ContactsStatePage extends State {
},
child: Text(
AppLocalizations.of(context).contacts,
- style: TextStyle(color: nav == 0 ? DarkColors.mainColor : Colors.white54, fontSize: 22.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, TextStyle(color: nav == 0 ? DarkColors.mainColor : Colors.white54, fontSize: 22.0, fontWeight: FontWeight.w700)),
),
),
const SizedBox(width: 10),
@@ -221,7 +212,7 @@ class ContactsStatePage extends State {
},
child: Text(
AppLocalizations.of(context).wallet,
- style: TextStyle(color: nav == 1 ? DarkColors.mainColor : Colors.white54, fontSize: 22.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, TextStyle(color: nav == 1 ? DarkColors.mainColor : Colors.white54, fontSize: 22.0, fontWeight: FontWeight.w700)),
),
),
],
@@ -242,7 +233,7 @@ class ContactsStatePage extends State {
return Column(children: [
const SizedBox(height: 20),
const Icon(Icons.crop_landscape, size: 100, color: Colors.white),
- Text(pos == 0 ? AppLocalizations.of(context).no_contacts : AppLocalizations.of(context).no_wallets, style: const TextStyle(color: Colors.white, fontSize: 14)),
+ Text(pos == 0 ? AppLocalizations.of(context).no_contacts : AppLocalizations.of(context).no_wallets, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 14))),
]);
}
ContactsItem item = isContact ? contacts.contactsList[index] : ContactsItem(walletList[index].name, walletList[index].address);
@@ -272,12 +263,12 @@ class ContactsStatePage extends State {
children: [
Text(
item.name,
- style: const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
const SizedBox(height: 5),
Text(
item.address,
- style: const TextStyle(color: Colors.white54, fontSize: 12.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white54, fontSize: 12.0, fontWeight: FontWeight.w500)),
),
],
),
diff --git a/lib/page/detail/receive_page.dart b/lib/page/detail/receive_page.dart
index b3999de..24b1d48 100644
--- a/lib/page/detail/receive_page.dart
+++ b/lib/page/detail/receive_page.dart
@@ -20,8 +20,8 @@ class ReceivePage extends StatelessWidget {
ScreenHelper.initScreen(context);
double marginH = 20;
double paddingH = 15;
- TextStyle titleStyle = const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w400);
- TextStyle addressStyle = const TextStyle(color: Colors.white54, fontSize: 16, fontWeight: FontWeight.w700);
+ TextStyle titleStyle = Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w400));
+ TextStyle addressStyle = Helper.fitChineseFont(context, const TextStyle(color: Colors.white54, fontSize: 16, fontWeight: FontWeight.w700));
return ModalFrame(
title: '${AppLocalizations.of(context).receive} XDAG',
@@ -126,7 +126,7 @@ class Button extends StatelessWidget {
@override
Widget build(BuildContext context) {
- TextStyle btnStyle = const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w400);
+ TextStyle btnStyle = Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w400));
return MyCupertinoButton(
padding: EdgeInsets.zero,
onPressed: onPressed,
diff --git a/lib/page/detail/send_page.dart b/lib/page/detail/send_page.dart
index 0b74865..0aba7e6 100644
--- a/lib/page/detail/send_page.dart
+++ b/lib/page/detail/send_page.dart
@@ -10,10 +10,13 @@ import 'package:xdag/common/global.dart';
import 'package:xdag/common/helper.dart';
import 'package:xdag/common/transaction.dart';
import 'package:xdag/model/config_modal.dart';
+import 'package:xdag/model/contacts_modal.dart';
import 'package:xdag/model/db_model.dart';
import 'package:xdag/model/wallet_modal.dart';
+import 'package:xdag/page/common/add_contacts_page.dart';
import 'package:xdag/page/common/check_page.dart';
import 'package:xdag/page/detail/transaction_page.dart';
+import 'package:xdag/page/wallet/contacts_page.dart';
import 'package:xdag/widget/button.dart';
import 'package:xdag/widget/desktop.dart';
import 'package:xdag/widget/nav_header.dart';
@@ -115,8 +118,37 @@ class _SendPageState extends State {
remark = '';
});
Helper.changeAndroidStatusBar(true);
- await Helper.showBottomSheet(context, TransactionPage(transaction: transactionItem, address: fromAddress));
- Helper.changeAndroidStatusBar(false);
+ ContactsItem? item = await Helper.showBottomSheet(context, TransactionPage(transaction: transactionItem, address: fromAddress));
+ if (item == null) {
+ Helper.changeAndroidStatusBar(false);
+ return;
+ }
+ // 延迟一下,等待页面收起
+ await Future.delayed(const Duration(milliseconds: 200));
+ if (item.name.isNotEmpty) {
+ if (context.mounted) {
+ String? reslut = (await Helper.showBottomSheet(
+ context,
+ ContactsDetail(item: item),
+ )) as String?;
+ Helper.changeAndroidStatusBar(false);
+ if (reslut == 'send') {
+ if (context.mounted) {
+ Navigator.pushNamed(context, '/send', arguments: SendPageRouteParams(address: item.address, name: item.name));
+ }
+ }
+ }
+ } else {
+ Helper.changeAndroidStatusBar(false);
+ if (context.mounted) {
+ showModalBottomSheet(
+ backgroundColor: DarkColors.bgColor,
+ context: context,
+ isScrollControlled: true,
+ builder: (BuildContext buildContext) => AddContactsPage(item: item),
+ );
+ }
+ }
} else {
// snackbar
setState(() {
@@ -180,18 +212,18 @@ class _SendPageState extends State {
child: Row(
children: [
const SizedBox(width: 15),
- Text(AppLocalizations.of(context).to, style: const TextStyle(fontSize: 16, color: Colors.white54, fontWeight: FontWeight.w500)),
+ Text(AppLocalizations.of(context).to, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, color: Colors.white54, fontWeight: FontWeight.w500))),
const SizedBox(width: 15),
Expanded(
child: ExtendedText(
args.name.isEmpty ? args.address : args.name,
textAlign: TextAlign.center,
maxLines: 1,
- style: const TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500),
- overflowWidget: const TextOverflowWidget(
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500)),
+ overflowWidget: TextOverflowWidget(
position: TextOverflowPosition.middle,
align: TextOverflowAlign.center,
- child: Text('...', style: TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500)),
+ child: Text('...', style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500))),
),
),
),
@@ -203,7 +235,7 @@ class _SendPageState extends State {
),
),
const SizedBox(height: 15),
- Text(AppLocalizations.of(context).amount, style: const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500)),
+ Text(AppLocalizations.of(context).amount, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500))),
const SizedBox(height: 15),
AutoSizeTextField(
controller: controller,
@@ -221,22 +253,18 @@ class _SendPageState extends State {
keyboardType: const TextInputType.numberWithOptions(decimal: true),
keyboardAppearance: Brightness.dark,
textAlign: TextAlign.center,
- style: const TextStyle(
- fontSize: 32,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 32, fontWeight: FontWeight.w500, color: Colors.white)),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'^\d+\.?\d{0,2}')),
],
- decoration: const InputDecoration(
+ decoration: InputDecoration(
filled: true,
- contentPadding: EdgeInsets.fromLTRB(15, 40, 15, 40),
+ contentPadding: const EdgeInsets.fromLTRB(15, 40, 15, 40),
fillColor: DarkColors.blockColor,
hintText: 'XDAG',
- hintStyle: TextStyle(decoration: TextDecoration.none, fontSize: 32, fontWeight: FontWeight.w500, color: Colors.white54),
- enabledBorder: OutlineInputBorder(borderSide: BorderSide.none, borderRadius: BorderRadius.all(Radius.circular(10))),
- focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: DarkColors.mainColor, width: 1), borderRadius: BorderRadius.all(Radius.circular(10))),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 32, fontWeight: FontWeight.w500, color: Colors.white54)),
+ enabledBorder: const OutlineInputBorder(borderSide: BorderSide.none, borderRadius: BorderRadius.all(Radius.circular(10))),
+ focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: DarkColors.mainColor, width: 1), borderRadius: BorderRadius.all(Radius.circular(10))),
),
),
const SizedBox(height: 5),
@@ -257,7 +285,7 @@ class _SendPageState extends State {
},
child: Row(
children: [
- Text('${wallet.amount} XDAG', style: const TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500)),
+ Text('${wallet.amount} XDAG', style: Helper.fitChineseFont(context, const TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500))),
const SizedBox(width: 10),
Container(
//radius: 10,
@@ -268,7 +296,7 @@ class _SendPageState extends State {
borderRadius: BorderRadius.circular(5),
),
child: Center(
- child: Text(AppLocalizations.of(context).all, style: const TextStyle(fontSize: 12, color: Colors.white, fontWeight: FontWeight.w500)),
+ child: Text(AppLocalizations.of(context).all, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, color: Colors.white, fontWeight: FontWeight.w500))),
),
)
],
@@ -277,7 +305,7 @@ class _SendPageState extends State {
],
),
),
- Text(AppLocalizations.of(context).remark, style: const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500)),
+ Text(AppLocalizations.of(context).remark, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500))),
const SizedBox(height: 15),
AutoSizeTextField(
controller: controller2,
@@ -300,22 +328,14 @@ class _SendPageState extends State {
);
},
textInputAction: TextInputAction.done,
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
filled: true,
contentPadding: const EdgeInsets.all(15),
fillColor: DarkColors.blockColor,
- counterStyle: const TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w400,
- color: Colors.white,
- ),
+ counterStyle: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white)),
hintText: AppLocalizations.of(context).remark,
- hintStyle: const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide.none, borderRadius: BorderRadius.all(Radius.circular(10))),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: DarkColors.mainColor, width: 1), borderRadius: BorderRadius.all(Radius.circular(10))),
),
@@ -329,7 +349,7 @@ class _SendPageState extends State {
color: DarkColors.redColorMask,
borderRadius: BorderRadius.circular(10),
),
- child: Text(error, style: const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500)),
+ child: Text(error, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, color: DarkColors.redColor, fontWeight: FontWeight.w500))),
)
else
const SizedBox(height: 20),
diff --git a/lib/page/detail/transaction_page.dart b/lib/page/detail/transaction_page.dart
index 3b12209..a6c40d3 100644
--- a/lib/page/detail/transaction_page.dart
+++ b/lib/page/detail/transaction_page.dart
@@ -6,11 +6,11 @@ import 'package:provider/provider.dart';
import 'package:xdag/common/color.dart';
import 'package:xdag/common/helper.dart';
import 'package:xdag/model/config_modal.dart';
+import 'package:xdag/model/contacts_modal.dart';
import 'package:xdag/model/wallet_modal.dart';
import 'package:xdag/widget/button.dart';
import 'package:xdag/widget/desktop.dart';
import 'package:xdag/widget/modal_frame.dart';
-import 'package:xdag/common/global.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class TransactionPage extends StatefulWidget {
@@ -93,6 +93,12 @@ class _TransactionPageState extends State {
Transaction transaction = widget.transaction;
String address = widget.address;
bool isSend = transaction.from == address;
+ // String otherAddress = isSend ? transaction.to : transaction.from;
+ ContactsModal contacts = Provider.of(context);
+ // 查询 otherAddress 是否在 contacts.contactsList 中
+ ContactsItem otherContact = contacts.contactsList.firstWhere((element) => element.address == otherAddress, orElse: () => ContactsItem("", otherAddress));
+
+ // if(transaction.amount)
return ModalFrame(
height: height,
title: isSend ? AppLocalizations.of(context).send : AppLocalizations.of(context).receive,
@@ -108,17 +114,12 @@ class _TransactionPageState extends State {
isShowRightCloseButton: true,
child: Column(
children: [
- Text(isSend ? '-${transaction.amount} XDAG' : '+${transaction.amount} XDAG', style: TextStyle(decoration: TextDecoration.none, fontSize: 22, fontWeight: FontWeight.w700, color: isSend ? DarkColors.bottomNavColor : DarkColors.greenColor)),
+ Text(isSend ? '-${transaction.amount} XDAG' : '+${transaction.amount} XDAG', style: Helper.fitChineseFont(context, TextStyle(decoration: TextDecoration.none, fontSize: 22, fontWeight: FontWeight.w700, color: isSend ? DarkColors.bottomNavColor : DarkColors.greenColor))),
const SizedBox(height: 5),
if (transaction.status == 'pending')
Text(
"${AppLocalizations.of(context).state}: $transactionState",
- style: TextStyle(
- decoration: TextDecoration.none,
- fontSize: 14,
- fontWeight: FontWeight.w400,
- color: transactionState == 'Accepted' ? DarkColors.greenColor : DarkColors.redColor,
- ),
+ style: Helper.fitChineseFont(context, TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w400, color: transactionState == 'Accepted' ? DarkColors.greenColor : DarkColors.redColor)),
)
else
const SizedBox(),
@@ -127,7 +128,7 @@ class _TransactionPageState extends State {
else
Text(
"${isSend ? AppLocalizations.of(context).send_on : AppLocalizations.of(context).receive_on} ${Helper.formatFullTime(transaction.time)} UTC",
- style: const TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white54),
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white54)),
),
const SizedBox(height: 25),
if (isLoading)
@@ -152,11 +153,11 @@ class _TransactionPageState extends State {
showCopy: true,
borderRadius: const BorderRadius.only(topLeft: Radius.circular(8), topRight: Radius.circular(8)),
title: isSend ? AppLocalizations.of(context).receiver : AppLocalizations.of(context).sender,
- value: otherAddress,
+ value: otherContact.name.isEmpty ? otherContact.address : otherContact.name,
+ leftIcon: otherContact.name.isEmpty ? const Icon(Icons.add, color: Colors.white, size: 10) : const Icon(Icons.person, color: Colors.white, size: 10),
),
onPressed: () {
- Clipboard.setData(ClipboardData(text: otherAddress));
- Helper.showToast(context, AppLocalizations.of(context).copied_to_clipboard);
+ Navigator.of(context).pop(otherContact);
}),
const SizedBox(height: 1),
MyCupertinoButton(
@@ -212,7 +213,7 @@ class TransactionShowDetail extends StatelessWidget {
Expanded(
child: Column(
children: [
- Text('${transaction.amount} XDAG', textAlign: TextAlign.center, style: const TextStyle(decoration: TextDecoration.none, fontSize: 22, fontWeight: FontWeight.w700, color: DarkColors.greenColor)),
+ Text('${transaction.amount} XDAG', textAlign: TextAlign.center, style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 22, fontWeight: FontWeight.w700, color: DarkColors.greenColor))),
const SizedBox(height: 20),
TransactionButton(
showCopy: false,
@@ -273,17 +274,13 @@ class TransactionButton extends StatelessWidget {
final BorderRadiusGeometry borderRadius;
final bool showCopy;
final bool readFont;
- const TransactionButton({super.key, required this.title, required this.value, required this.showCopy, this.readFont = false, this.borderRadius = const BorderRadius.all(Radius.circular(0))});
+ final Icon? leftIcon;
+ const TransactionButton({super.key, this.leftIcon, required this.title, required this.value, required this.showCopy, this.readFont = false, this.borderRadius = const BorderRadius.all(Radius.circular(0))});
@override
Widget build(BuildContext context) {
- TextStyle titleStyle = const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white54);
- TextStyle valueStyle = TextStyle(
- decoration: TextDecoration.none,
- fontSize: 12,
- fontWeight: FontWeight.w700,
- color: readFont ? DarkColors.redColor : Colors.white,
- );
+ TextStyle titleStyle = Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white54));
+ TextStyle valueStyle = Helper.fitChineseFont(context, TextStyle(decoration: TextDecoration.none, fontSize: 12, fontWeight: FontWeight.w700, color: readFont ? DarkColors.redColor : Colors.white));
Widget icon = showCopy == true
? Container(
margin: const EdgeInsets.only(left: 5),
@@ -293,7 +290,7 @@ class TransactionButton extends StatelessWidget {
color: DarkColors.bgColor,
borderRadius: BorderRadius.all(Radius.circular(14)),
),
- child: const Icon(Icons.copy_rounded, size: 10, color: Colors.white))
+ child: leftIcon ?? const Icon(Icons.copy_rounded, size: 10, color: Colors.white))
: const SizedBox(width: 0);
return Container(
height: 50,
diff --git a/lib/page/detail/wallet_detail.dart b/lib/page/detail/wallet_detail.dart
index 63aac44..ba6bd4e 100644
--- a/lib/page/detail/wallet_detail.dart
+++ b/lib/page/detail/wallet_detail.dart
@@ -39,7 +39,7 @@ class WalletDetailPage extends StatelessWidget {
padding: EdgeInsets.zero,
child: Row(
children: [
- Text(wallet.address, style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white)),
+ Text(wallet.address, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white))),
const SizedBox(width: 5),
const Icon(Icons.copy_rounded, size: 12, color: Colors.white),
],
@@ -64,7 +64,7 @@ class WalletDetailPage extends StatelessWidget {
},
child: Row(
children: [
- Text(wallet.name, style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white54)),
+ Text(wallet.name, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white54))),
const SizedBox(width: 5),
const Icon(Icons.arrow_forward_ios, color: Colors.white, size: 16),
],
diff --git a/lib/page/detail/wallet_list_page.dart b/lib/page/detail/wallet_list_page.dart
index df05ebe..d615adf 100644
--- a/lib/page/detail/wallet_list_page.dart
+++ b/lib/page/detail/wallet_list_page.dart
@@ -125,7 +125,7 @@ class _WalletListPageState extends State {
child: Center(
child: Text(
AppLocalizations.of(context).tips,
- style: const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700)),
),
)),
const SizedBox(width: 40)
@@ -133,7 +133,7 @@ class _WalletListPageState extends State {
),
content: Text(
AppLocalizations.of(context).wallet_tips,
- style: const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
actions: [
Column(
@@ -256,7 +256,7 @@ class Item extends StatelessWidget {
child: Center(
child: Text(
AppLocalizations.of(context).attention,
- style: const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700)),
),
)),
const SizedBox(width: 40)
@@ -264,7 +264,7 @@ class Item extends StatelessWidget {
),
content: Text(
AppLocalizations.of(context).delete_tip,
- style: const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
actions: [
Column(
@@ -330,10 +330,10 @@ class Item extends StatelessWidget {
wallet!.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500)),
),
const SizedBox(height: 3),
- Text(wallet!.address, maxLines: 1, style: const TextStyle(color: Colors.white54, fontSize: 12, fontWeight: FontWeight.w700)),
+ Text(wallet!.address, maxLines: 1, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white54, fontSize: 12, fontWeight: FontWeight.w700))),
],
),
),
diff --git a/lib/page/home_page.dart b/lib/page/home_page.dart
index 252d627..01d5cc2 100644
--- a/lib/page/home_page.dart
+++ b/lib/page/home_page.dart
@@ -50,7 +50,7 @@ class HomePage extends StatelessWidget {
child: Center(
child: Text(
AppLocalizations.of(context).attention,
- style: const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700)),
),
)),
const SizedBox(width: 40)
@@ -58,7 +58,7 @@ class HomePage extends StatelessWidget {
),
content: Text(
AppLocalizations.of(context).reset_password_tips,
- style: const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
actions: [
Column(
diff --git a/lib/page/start_page.dart b/lib/page/start_page.dart
index 7fd1a5a..786dbfe 100644
--- a/lib/page/start_page.dart
+++ b/lib/page/start_page.dart
@@ -1,3 +1,4 @@
+import 'dart:io';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:xdag/common/color.dart';
@@ -7,6 +8,7 @@ import 'package:xdag/model/wallet_modal.dart';
import 'package:xdag/page/common/check_page.dart';
import 'package:xdag/page/home_page.dart';
import 'package:xdag/page/wallet/main_page.dart';
+import 'package:back_to_home/back_to_home.dart';
class StartPage extends StatefulWidget {
const StartPage({super.key});
@@ -15,7 +17,8 @@ class StartPage extends StatefulWidget {
}
class _StartPageState extends State {
- int needCheck = -1; // 0: no check, 1: to check, 2: check ok
+ int needCheck = -1;
+ DateTime? lastPopTime; // 0: no check, 1: to check, 2: check ok
@override
void initState() {
super.initState();
@@ -59,10 +62,15 @@ class _StartPageState extends State {
body: null,
);
}
- if (wallet == null) {
- return const HomePage();
- } else {
- return const WalletHomePage();
- }
+ return WillPopScope(
+ onWillPop: () async {
+ if (Platform.isAndroid) {
+ BackToHome.backToPhoneHome();
+ return false;
+ }
+ return true;
+ },
+ child: wallet == null ? const HomePage() : const WalletHomePage(),
+ );
}
}
diff --git a/lib/page/wallet/contacts_page.dart b/lib/page/wallet/contacts_page.dart
index 78d95cc..a5c66c2 100644
--- a/lib/page/wallet/contacts_page.dart
+++ b/lib/page/wallet/contacts_page.dart
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:xdag/common/color.dart';
import 'package:xdag/common/helper.dart';
@@ -16,12 +17,6 @@ class ContactsMainPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
var topPadding = ScreenHelper.topPadding;
- const titleStyle = TextStyle(
- decoration: TextDecoration.none,
- fontSize: 32,
- fontWeight: FontWeight.w700,
- color: Colors.white,
- );
ContactsModal contacts = Provider.of(context);
return Scaffold(
backgroundColor: DarkColors.bgColor,
@@ -35,7 +30,7 @@ class ContactsMainPage extends StatelessWidget {
Expanded(
child: Text(
AppLocalizations.of(context).contacts,
- style: titleStyle,
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 32, fontWeight: FontWeight.w700, color: Colors.white)),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
@@ -74,7 +69,7 @@ class ContactsMainPage extends StatelessWidget {
return Column(children: [
const SizedBox(height: 50),
const Icon(Icons.crop_landscape, size: 100, color: Colors.white),
- Text(AppLocalizations.of(context).no_transactions, style: const TextStyle(color: Colors.white, fontSize: 16)),
+ Text(AppLocalizations.of(context).no_transactions, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16))),
const SizedBox(height: 50),
]);
}
@@ -126,7 +121,7 @@ class ContactsMainPage extends StatelessWidget {
child: Center(
child: Text(
AppLocalizations.of(context).attention,
- style: const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700)),
),
)),
const SizedBox(width: 40)
@@ -134,7 +129,7 @@ class ContactsMainPage extends StatelessWidget {
),
content: Text(
AppLocalizations.of(context).delete_contact,
- style: const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
actions: [
Column(
@@ -201,7 +196,7 @@ class ContactsMainPage extends StatelessWidget {
Expanded(
child: Text(
item.name,
- style: const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500),
+ style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
),
const SizedBox(width: 5),
@@ -227,7 +222,7 @@ class ContactsDetail extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ModalFrame(
- title: AppLocalizations.of(context).contacts,
+ title: item.name,
isHideLeftDownButton: true,
isShowRightCloseButton: true,
child: Container(
@@ -237,15 +232,15 @@ class ContactsDetail extends StatelessWidget {
Expanded(
child: Column(
children: [
- Text(item.name, style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w400)),
- const SizedBox(height: 15),
+ // Text(item.name, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w400))),
+ // const SizedBox(height: 15),
Container(
decoration: BoxDecoration(
color: DarkColors.blockColor,
borderRadius: BorderRadius.circular(8),
),
padding: const EdgeInsets.all(15),
- child: Text(item.address, style: const TextStyle(color: Colors.white54, fontSize: 16, fontWeight: FontWeight.w700)),
+ child: Text(item.address, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white54, fontSize: 16, fontWeight: FontWeight.w700))),
),
],
),
@@ -255,7 +250,7 @@ class ContactsDetail extends StatelessWidget {
margin: EdgeInsets.fromLTRB(15, 20, 15, ScreenHelper.bottomPadding > 0 ? ScreenHelper.bottomPadding : 20),
// color: Colors.green,
child: Row(
- mainAxisAlignment: canEdit ? MainAxisAlignment.spaceAround : MainAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
if (canEdit)
MyCupertinoButton(
@@ -277,9 +272,7 @@ class ContactsDetail extends StatelessWidget {
onPressed: () {
Navigator.of(context).pop("delete");
},
- )
- else
- const SizedBox(),
+ ),
if (canEdit)
MyCupertinoButton(
padding: EdgeInsets.zero,
@@ -300,9 +293,7 @@ class ContactsDetail extends StatelessWidget {
onPressed: () {
Navigator.of(context).pop("edit");
},
- )
- else
- const SizedBox(),
+ ),
MyCupertinoButton(
padding: EdgeInsets.zero,
child: Container(
@@ -323,6 +314,27 @@ class ContactsDetail extends StatelessWidget {
Navigator.of(context).pop("send");
},
),
+ MyCupertinoButton(
+ padding: EdgeInsets.zero,
+ child: Container(
+ width: 60,
+ height: 60,
+ decoration: BoxDecoration(
+ color: DarkColors.blockColor,
+ borderRadius: BorderRadius.circular(30),
+ ),
+ child: const Center(
+ child: Icon(
+ Icons.copy,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ onPressed: () {
+ Clipboard.setData(ClipboardData(text: item.address));
+ Helper.showToast(context, AppLocalizations.of(context).copied_to_clipboard);
+ },
+ ),
],
),
)
diff --git a/lib/page/wallet/main_page.dart b/lib/page/wallet/main_page.dart
index d014d84..94cb04b 100644
--- a/lib/page/wallet/main_page.dart
+++ b/lib/page/wallet/main_page.dart
@@ -30,7 +30,7 @@ class _WalletHomePageState extends State {
Widget build(BuildContext context) {
ScreenHelper.initScreen(context);
return Scaffold(
- key: Helper.scaffoldMessengerKey,
+ // key: Helper.scaffoldMessengerKey,
appBar: null,
body: IndexedStack(index: _currentIndex, children: _bottomNavPages),
backgroundColor: DarkColors.bgColor,
diff --git a/lib/page/wallet/wallet_page.dart b/lib/page/wallet/wallet_page.dart
index b3643e8..3ef7046 100644
--- a/lib/page/wallet/wallet_page.dart
+++ b/lib/page/wallet/wallet_page.dart
@@ -2,7 +2,6 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:xdag/common/color.dart';
-import 'package:xdag/common/global.dart';
import 'package:xdag/common/helper.dart';
import 'package:xdag/model/config_modal.dart';
import 'package:xdag/model/db_model.dart';
@@ -29,7 +28,7 @@ class _WalletPageState extends State {
CancelToken cancelToken = CancelToken();
int currentPage = 1;
int totalPage = 1;
- bool loading = false;
+ bool loading = true;
final ScrollController _scrollController = ScrollController();
@override
void initState() {
@@ -37,7 +36,8 @@ class _WalletPageState extends State {
_crurrentAddress = Provider.of(context, listen: false).getWallet().address;
_network = Provider.of(context, listen: false).walletConfig.network;
WidgetsBinding.instance.addPostFrameCallback((_) async {
- _refreshIndicatorKey.currentState?.show();
+ // _refreshIndicatorKey.currentState?.show();
+ fetchFristPage();
});
_scrollController.addListener(_scrollListener);
}
@@ -58,44 +58,73 @@ class _WalletPageState extends State {
_scrollController.dispose();
cancelToken.cancel();
dio.close();
- WalletModal walletModal = Provider.of(context);
- ConfigModal configModal = Provider.of(context);
- walletModal.removeListener(_onWalletModalChange);
- configModal.removeListener(_onConfigModalChange);
+ try {
+ WalletModal walletModal = Provider.of(context, listen: false);
+ ConfigModal configModal = Provider.of(context, listen: false);
+ walletModal.removeListener(_onWalletModalChange);
+ configModal.removeListener(_onConfigModalChange);
+ // ignore: empty_catches
+ } catch (e) {}
super.dispose();
}
_onWalletModalChange() {
+ if (!context.mounted) return;
+ Wallet newWallet = Provider.of(context, listen: false).getWallet();
+ if (newWallet.address.isEmpty) {
+ if (loading) {
+ cancelToken.cancel();
+ cancelToken = CancelToken();
+ }
+ return;
+ }
if (_crurrentAddress != Provider.of(context, listen: false).getWallet().address) {
- _crurrentAddress = Provider.of(context, listen: false).getWallet().address;
+ _refreshIndicatorKey.currentState?.deactivate();
setState(() {
list = [];
});
- _refreshIndicatorKey.currentState?.show();
+ fetchFristPage();
+ _crurrentAddress = Provider.of(context, listen: false).getWallet().address;
}
}
_onConfigModalChange() {
+ if (!context.mounted) return;
WalletModal walletModal = Provider.of(context, listen: false);
if (_network != Provider.of(context, listen: false).walletConfig.network) {
- _network = Provider.of(context, listen: false).walletConfig.network;
+ _refreshIndicatorKey.currentState?.deactivate();
setState(() {
list = [];
});
+ fetchFristPage();
walletModal.setBlance("0.00");
- _refreshIndicatorKey.currentState?.show();
}
}
void _scrollListener() {
+ if (loading) return;
if (!loading && _scrollController.position.pixels > _scrollController.position.maxScrollExtent - 100 && currentPage < totalPage) {
currentPage += 1;
fetchPage();
}
}
+ fetchFristPage() async {
+ if (loading) {
+ cancelToken.cancel();
+ cancelToken = CancelToken();
+ }
+ setState(() {
+ loading = false;
+ currentPage = 1;
+ });
+ // 延迟一下,防止刷新的时候,页面还没加载完
+ await Future.delayed(const Duration(milliseconds: 100));
+ await fetchPage();
+ }
+
fetchPage() async {
- if (loading) return;
+ // if (loading) return;
setState(() {
loading = true;
});
@@ -115,9 +144,11 @@ class _WalletPageState extends State {
});
walletModal.setBlance(responseBalance.data['result']);
Response response = await dio.get(
- "$explorURL/block/${wallet.address}?addresses_page=$currentPage&addresses_per_page=200",
+ "$explorURL/block/${wallet.address}?addresses_page=$currentPage&addresses_per_page=100",
cancelToken: cancelToken,
);
+ // print("address: ${wallet.address}");
+ // print("fetchPage time: ${DateTime.now().difference(startTime).inMilliseconds}ms");
if (response.data["addresses_pagination"] != null) {
totalPage = response.data["addresses_pagination"]["last_page"];
}
@@ -134,7 +165,7 @@ class _WalletPageState extends State {
status: "",
from: item["direction"] == 'input' ? "" : wallet.address,
to: item["direction"] != 'input' ? "" : wallet.address,
- type: item["direction"] != 'snapshot' ? 0 : 1,
+ type: item["direction"] != 'snapshot' && item["direction"] != 'earning' ? 0 : 1,
hash: '',
blockAddress: item["address"],
fee: 0,
@@ -144,7 +175,7 @@ class _WalletPageState extends State {
} catch (e) {}
}
List allList = currentPage == 1 ? newList : list + newList;
- allList.where((element) => element.type != 2).toList();
+ allList = allList.where((element) => element.type != 2).toList();
List newList2 = [];
newList2.addAll(allList);
String lastTime = "";
@@ -164,21 +195,18 @@ class _WalletPageState extends State {
}
} catch (e) {
if (mounted) {
- setState(() {
- loading = false;
- });
+ try {
+ setState(() {
+ loading = false;
+ });
+ // ignore: empty_catches
+ } catch (e) {}
}
}
}
@override
Widget build(BuildContext context) {
- const titleStyle = TextStyle(
- decoration: TextDecoration.none,
- fontSize: 22,
- fontWeight: FontWeight.w700,
- color: Colors.white,
- );
WalletModal walletModal = Provider.of(context);
Wallet wallet = walletModal.getWallet();
return Container(
@@ -195,7 +223,7 @@ class _WalletPageState extends State {
child: Center(
child: Text(
wallet.name,
- style: titleStyle,
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 22, fontWeight: FontWeight.w700, color: Colors.white)),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -219,13 +247,8 @@ class _WalletPageState extends State {
child: RefreshIndicator(
key: _refreshIndicatorKey,
color: DarkColors.mainColor,
- semanticsLabel: "1123",
onRefresh: () async {
- cancelToken.cancel();
- cancelToken = CancelToken();
- loading = false;
- currentPage = 1;
- await fetchPage();
+ await fetchFristPage();
},
child: ListView.builder(
physics: const AlwaysScrollableScrollPhysics(),
@@ -235,18 +258,18 @@ class _WalletPageState extends State {
itemBuilder: (BuildContext buildContext, int index) {
if (index == 0) return const WalletHeader();
if (index == list.length + 1) {
- if (list.isEmpty) {
+ if (list.isEmpty && !loading) {
return Column(children: [
const SizedBox(height: 50),
const Icon(Icons.crop_landscape, size: 100, color: Colors.white),
- Text(AppLocalizations.of(context).no_transactions, style: const TextStyle(color: Colors.white, fontSize: 16)),
+ Text(AppLocalizations.of(context).no_transactions, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16))),
const SizedBox(height: 50),
]);
}
if (loading) {
return Column(
children: const [
- SizedBox(height: 20),
+ SizedBox(height: 30),
Center(
child: SizedBox(
width: 30,
diff --git a/lib/page/wallet/wallet_setting.dart b/lib/page/wallet/wallet_setting.dart
index e518a86..f50acc1 100644
--- a/lib/page/wallet/wallet_setting.dart
+++ b/lib/page/wallet/wallet_setting.dart
@@ -14,8 +14,6 @@ class WalletSettingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
var topPadding = ScreenHelper.topPadding;
- const titleStyle = TextStyle(decoration: TextDecoration.none, fontSize: 32, fontWeight: FontWeight.w700, color: Colors.white);
- const labelStyle = TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w400);
ConfigModal config = Provider.of(context);
return Scaffold(
backgroundColor: DarkColors.bgColor,
@@ -29,7 +27,7 @@ class WalletSettingPage extends StatelessWidget {
Expanded(
child: Text(
AppLocalizations.of(context).setting,
- style: titleStyle,
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 32, fontWeight: FontWeight.w700, color: Colors.white)),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
@@ -51,7 +49,7 @@ class WalletSettingPage extends StatelessWidget {
},
child: Row(
children: [
- Text(config.walletConfig.local == 0 ? AppLocalizations.of(context).auto : ConfigModal.langs[config.walletConfig.local].name, style: labelStyle),
+ Text(config.walletConfig.local == 0 ? AppLocalizations.of(context).auto : ConfigModal.langs[config.walletConfig.local].name, style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w400))),
const SizedBox(width: 5),
const Icon(Icons.arrow_forward_ios, color: Colors.white, size: 12),
],
@@ -68,7 +66,7 @@ class WalletSettingPage extends StatelessWidget {
},
child: Row(
children: [
- Text(ConfigModal.netWorks[config.walletConfig.network], style: labelStyle),
+ Text(ConfigModal.netWorks[config.walletConfig.network], style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w400))),
const SizedBox(width: 5),
const Icon(Icons.arrow_forward_ios, color: Colors.white, size: 12),
],
@@ -103,9 +101,9 @@ class WalletSettingPage extends StatelessWidget {
const SizedBox(height: 30),
Image.asset("images/logo.png", width: 30, height: 30),
const SizedBox(height: 5),
- const Text("XDAG-Pro", style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500)),
+ Text("XDAG-Pro", style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500))),
const SizedBox(height: 5),
- Text('Version ${Global.version}(${Global.buildNumber})', style: const TextStyle(color: Colors.white54, fontSize: 12, fontWeight: FontWeight.w400)),
+ Text('Version ${Global.version}(${Global.buildNumber})', style: Helper.fitChineseFont(context, const TextStyle(color: Colors.white54, fontSize: 12, fontWeight: FontWeight.w400))),
],
))),
),
diff --git a/lib/widget/button.dart b/lib/widget/button.dart
index 4849124..051bf4e 100644
--- a/lib/widget/button.dart
+++ b/lib/widget/button.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:xdag/common/color.dart';
+import 'package:xdag/common/helper.dart';
import 'package:xdag/widget/desktop.dart';
class Button extends StatelessWidget {
@@ -43,11 +44,7 @@ class Button extends StatelessWidget {
: Text(
text,
textAlign: TextAlign.center,
- style: TextStyle(
- color: textColor,
- fontSize: 16.0,
- fontWeight: FontWeight.w500,
- ),
+ style: Helper.fitChineseFont(context, TextStyle(color: textColor, fontSize: 16.0, fontWeight: FontWeight.w500)),
),
));
}
diff --git a/lib/widget/home_button.dart b/lib/widget/home_button.dart
index 89e0719..8d3e18f 100644
--- a/lib/widget/home_button.dart
+++ b/lib/widget/home_button.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:xdag/common/color.dart';
+import 'package:xdag/common/helper.dart';
import 'package:xdag/widget/desktop.dart';
class HomeHeaderButton extends StatelessWidget {
@@ -36,7 +37,7 @@ class HomeHeaderButton extends StatelessWidget {
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.end,
- style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white)),
),
],
),
diff --git a/lib/widget/home_transaction_item.dart b/lib/widget/home_transaction_item.dart
index ed9e65f..0b155f3 100644
--- a/lib/widget/home_transaction_item.dart
+++ b/lib/widget/home_transaction_item.dart
@@ -1,9 +1,13 @@
import 'package:flutter/material.dart';
import 'package:xdag/common/color.dart';
import 'package:xdag/common/helper.dart';
+import 'package:xdag/model/contacts_modal.dart';
import 'package:xdag/model/wallet_modal.dart';
+import 'package:xdag/page/common/add_contacts_page.dart';
+import 'package:xdag/page/detail/send_page.dart';
import 'package:xdag/page/detail/transaction_page.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
+import 'package:xdag/page/wallet/contacts_page.dart';
import 'package:xdag/widget/desktop.dart';
class WalletTransactionDateHeader extends StatelessWidget {
@@ -16,7 +20,7 @@ class WalletTransactionDateHeader extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(15, 25, 15, 5),
child: Text(
Helper.formatDate(time),
- style: const TextStyle(decoration: TextDecoration.none, fontSize: 18, fontWeight: FontWeight.w700, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 18, fontWeight: FontWeight.w700, color: Colors.white)),
),
);
}
@@ -65,24 +69,55 @@ class WalletTransactionItem extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(isSnapshot ? AppLocalizations.of(context).snapshot : (isSend ? AppLocalizations.of(context).send : AppLocalizations.of(context).receive), style: const TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white)),
+ Text(isSnapshot ? AppLocalizations.of(context).snapshot : (isSend ? AppLocalizations.of(context).send : AppLocalizations.of(context).receive), style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white))),
const SizedBox(height: 3),
- Text('${Helper.formatTime(transaction.time)} UTC', style: const TextStyle(decoration: TextDecoration.none, fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white54)),
+ Text('${Helper.formatTime(transaction.time)} UTC', style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white54))),
],
),
),
),
const SizedBox(width: 10),
Expanded(
- child: Text(isSnapshot ? '$amount XDAG' : (isSend ? '-$amount XDAG' : '+$amount XDAG'), textAlign: TextAlign.end, style: TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w700, color: isSnapshot ? Colors.white54 : (isSend ? DarkColors.bottomNavColor : DarkColors.greenColor))),
+ child: Text(isSnapshot ? '$amount XDAG' : (isSend ? '-$amount XDAG' : '+$amount XDAG'), textAlign: TextAlign.end, style: Helper.fitChineseFont(context, TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w700, color: isSnapshot ? Colors.white54 : (isSend ? DarkColors.bottomNavColor : DarkColors.greenColor)))),
),
const SizedBox(width: 10),
],
),
),
- onPressed: () {
+ onPressed: () async {
if (isSnapshot) return;
- Helper.showBottomSheet(context, TransactionPage(transaction: transaction, address: address));
+ Helper.changeAndroidStatusBar(true);
+ ContactsItem? item = await Helper.showBottomSheet(context, TransactionPage(transaction: transaction, address: address));
+ if (item == null) {
+ Helper.changeAndroidStatusBar(false);
+ return;
+ }
+ // 延迟一下,等待页面收起
+ await Future.delayed(const Duration(milliseconds: 200));
+ if (item.name.isNotEmpty) {
+ if (context.mounted) {
+ String? reslut = (await Helper.showBottomSheet(
+ context,
+ ContactsDetail(item: item),
+ )) as String?;
+ Helper.changeAndroidStatusBar(false);
+ if (reslut == 'send') {
+ if (context.mounted) {
+ Navigator.pushNamed(context, '/send', arguments: SendPageRouteParams(address: item.address, name: item.name));
+ }
+ }
+ }
+ } else {
+ Helper.changeAndroidStatusBar(false);
+ if (context.mounted) {
+ showModalBottomSheet(
+ backgroundColor: DarkColors.bgColor,
+ context: context,
+ isScrollControlled: true,
+ builder: (BuildContext buildContext) => AddContactsPage(item: item),
+ );
+ }
+ }
});
}
}
diff --git a/lib/widget/home_widget.dart b/lib/widget/home_widget.dart
index 3fc935f..9c9b8cb 100644
--- a/lib/widget/home_widget.dart
+++ b/lib/widget/home_widget.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:xdag/common/color.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
+import 'package:xdag/common/helper.dart';
class Dot extends StatelessWidget {
final double size;
@@ -33,7 +34,7 @@ class HomeMainContent extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 20),
child: Text(
title,
- style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w500, color: Colors.white),
+ style: Helper.fitChineseFont(context, Helper.fitChineseFont(context, const TextStyle(fontSize: 24, fontWeight: FontWeight.w500, color: Colors.white))),
),
),
const SizedBox(height: 5),
@@ -41,7 +42,7 @@ class HomeMainContent extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 20),
child: Text(
subTitle,
- style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white54),
+ style: Helper.fitChineseFont(context, Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.white54))),
),
),
const Spacer(),
diff --git a/lib/widget/input.dart b/lib/widget/input.dart
index dcafbd6..649253b 100644
--- a/lib/widget/input.dart
+++ b/lib/widget/input.dart
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:xdag/common/color.dart';
+import 'package:xdag/common/helper.dart';
class Input extends StatefulWidget {
final String hintText;
@@ -45,23 +46,13 @@ class _InputState extends State {
keyboardAppearance: Brightness.dark,
autofocus: widget.isFocus,
cursorColor: DarkColors.mainColor,
- style: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
decoration: InputDecoration(
hintText: widget.hintText,
filled: true,
fillColor: DarkColors.blockColor,
contentPadding: const EdgeInsets.fromLTRB(15, 15, 0, 15),
- hintStyle: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white54,
- ),
+ hintStyle: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white54)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: DarkColors.mainColor, width: 1),
borderRadius: BorderRadius.all(Radius.circular(10)),
@@ -142,12 +133,7 @@ class MyRadioButton extends StatelessWidget {
constraints: const BoxConstraints(minHeight: 22.0),
child: Text(
title,
- style: TextStyle(
- decoration: TextDecoration.none,
- fontSize: 14,
- fontWeight: FontWeight.w500,
- color: textColor,
- ),
+ style: Helper.fitChineseFont(context, TextStyle(decoration: TextDecoration.none, fontSize: 14, fontWeight: FontWeight.w500, color: textColor)),
),
))
],
diff --git a/lib/widget/label_button.dart b/lib/widget/label_button.dart
index 9d29169..d61bbcc 100644
--- a/lib/widget/label_button.dart
+++ b/lib/widget/label_button.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:xdag/common/color.dart';
+import 'package:xdag/common/helper.dart';
import 'package:xdag/widget/desktop.dart';
class LabelButton extends StatelessWidget {
@@ -35,7 +36,7 @@ class LabelButton extends StatelessWidget {
borderRadius = const BorderRadius.all(Radius.circular(8));
}
- var labelStyle = TextStyle(color: textClolor, fontSize: 16, fontWeight: FontWeight.w500);
+ var labelStyle = Helper.fitChineseFont(context, TextStyle(color: textClolor, fontSize: 16, fontWeight: FontWeight.w500));
Widget? item = child ?? const Icon(Icons.arrow_forward_ios, color: Colors.white, size: 16);
return SizedBox(
// height: 55,
diff --git a/lib/widget/modal_frame.dart b/lib/widget/modal_frame.dart
index 0610c77..92d4a83 100644
--- a/lib/widget/modal_frame.dart
+++ b/lib/widget/modal_frame.dart
@@ -62,14 +62,7 @@ class ModalFrame extends StatelessWidget {
children: [
leftButton,
const SizedBox(width: 10),
- Expanded(
- child: Text(title,
- textAlign: TextAlign.center,
- style: const TextStyle(
- fontSize: 20,
- color: Colors.white,
- fontWeight: FontWeight.w700,
- ))),
+ Expanded(child: Text(title, textAlign: TextAlign.center, style: Helper.fitChineseFont(context, const TextStyle(fontSize: 20, color: Colors.white, fontWeight: FontWeight.w700)))),
const SizedBox(width: 10),
rightButton,
],
diff --git a/lib/widget/nav_button.dart b/lib/widget/nav_button.dart
index b20d8e9..2e0c0a0 100644
--- a/lib/widget/nav_button.dart
+++ b/lib/widget/nav_button.dart
@@ -39,12 +39,7 @@ class BottomNavButton extends StatelessWidget {
image,
Text(
text,
- style: TextStyle(
- decoration: TextDecoration.none,
- fontSize: 12,
- fontWeight: FontWeight.w500,
- color: color,
- ),
+ style: Helper.fitChineseFont(context, TextStyle(decoration: TextDecoration.none, fontSize: 12, fontWeight: FontWeight.w500, color: color)),
),
ScreenHelper.bottomPadding > 0 ? const SizedBox(height: 0) : const SizedBox(height: 5),
],
diff --git a/lib/widget/nav_header.dart b/lib/widget/nav_header.dart
index be1b3b5..ded835e 100644
--- a/lib/widget/nav_header.dart
+++ b/lib/widget/nav_header.dart
@@ -45,12 +45,7 @@ class NavHeader extends StatelessWidget {
child: Text(
title,
textAlign: TextAlign.center,
- style: const TextStyle(
- decoration: TextDecoration.none,
- fontSize: 20,
- fontWeight: FontWeight.w700,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(decoration: TextDecoration.none, fontSize: 20, fontWeight: FontWeight.w700, color: Colors.white)),
),
),
const SizedBox(width: 10),
diff --git a/lib/widget/security.dart b/lib/widget/security.dart
index 2764b30..1f3fe8b 100644
--- a/lib/widget/security.dart
+++ b/lib/widget/security.dart
@@ -218,7 +218,7 @@ class _InputPassCodeState extends State {
const Spacer(),
Text(
title,
- style: const TextStyle(fontSize: 22, fontWeight: FontWeight.w700, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 22, fontWeight: FontWeight.w700, color: Colors.white)),
),
const SizedBox(height: 10),
Row(mainAxisAlignment: MainAxisAlignment.center, children: renderDot(context)),
@@ -234,11 +234,6 @@ class NumberButton extends StatelessWidget {
final int index;
final void Function(int index)? onPressed;
const NumberButton({super.key, this.index = 0, required this.onPressed});
- static const numberTextStyle = TextStyle(
- fontSize: 25,
- color: Colors.white,
- fontWeight: FontWeight.w500,
- );
static double size = ScreenHelper.screenWidth < 400 || Helper.isDesktop ? 64 : 80;
@override
Widget build(BuildContext context) {
@@ -255,7 +250,7 @@ class NumberButton extends StatelessWidget {
width: size,
height: size,
child: Center(
- child: index != -2 ? Text("${index + 1}", style: numberTextStyle) : const Icon(Icons.backspace, color: Colors.white),
+ child: index != -2 ? Text("${index + 1}", style: Helper.fitChineseFont(context, const TextStyle(fontSize: 25, color: Colors.white, fontWeight: FontWeight.w500))) : const Icon(Icons.backspace, color: Colors.white),
)),
);
}
diff --git a/lib/widget/wallet_header.dart b/lib/widget/wallet_header.dart
index d37efb0..f874dfc 100644
--- a/lib/widget/wallet_header.dart
+++ b/lib/widget/wallet_header.dart
@@ -43,7 +43,7 @@ class WalletHeader extends StatelessWidget {
Expanded(
child: Text(
AppLocalizations.of(context).backup_your_wallet,
- style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white)),
),
),
const SizedBox(width: 5),
@@ -80,13 +80,9 @@ class WalletHeader extends StatelessWidget {
color: DarkColors.redColorMask,
borderRadius: BorderRadius.circular(5),
),
- child: const Text(
+ child: Text(
"TEST",
- style: TextStyle(
- fontSize: 10,
- fontWeight: FontWeight.w400,
- color: Colors.white70,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Colors.white70)),
),
),
const SizedBox(height: 8),
@@ -96,11 +92,7 @@ class WalletHeader extends StatelessWidget {
const SizedBox(),
Text(
wallet.hideBalance == true ? "****" : "${wallet.amount} XDAG",
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- ),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white)),
),
],
)
@@ -122,7 +114,7 @@ class WalletHeader extends StatelessWidget {
child: Text(
wallet.address,
textAlign: TextAlign.right,
- style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white54),
+ style: Helper.fitChineseFont(context, const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white54)),
),
),
const SizedBox(width: 8),
diff --git a/pubspec.lock b/pubspec.lock
index 9be5b32..3b58e20 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -41,6 +41,15 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.1"
+ back_to_home:
+ dependency: "direct main"
+ description:
+ path: "."
+ ref: HEAD
+ resolved-ref: "0e1bdc76a1d96b149d07a07514d18ba54e044df4"
+ url: "https://github.com/amazingCoding/flutter-back-to-phone-home.git"
+ source: git
+ version: "0.0.1"
bip32:
dependency: "direct main"
description:
@@ -1148,5 +1157,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
- dart: ">=2.19.5 <3.0.0"
+ dart: ">=2.19.6 <3.0.0"
flutter: ">=3.7.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index bc85cd1..ecf67b0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
-version: 1.0.11+12
+version: 1.0.12+13
environment:
sdk: '>=2.19.2 <3.0.0'
@@ -45,6 +45,9 @@ dependencies:
url: https://github.com/amazingCoding/flutter-scan-qr.git
package_info_plus: ^3.0.3
dio: ^5.0.3
+ back_to_home:
+ git:
+ url: https://github.com/amazingCoding/flutter-back-to-phone-home.git
easy_refresh: ^3.3.1
bip39: ^1.0.6
bip32: ^2.0.0