2022-08-06 02:22:41 +02:00
|
|
|
|
// ignore_for_file: use_build_context_synchronously
|
|
|
|
|
|
2021-11-21 01:50:05 +01:00
|
|
|
|
import 'package:bubble/bubble.dart';
|
2022-06-12 18:03:17 +02:00
|
|
|
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
2022-06-16 22:29:42 +02:00
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2021-01-26 21:00:26 +01:00
|
|
|
|
import 'package:gecko/globals.dart';
|
2022-12-07 23:10:28 +01:00
|
|
|
|
import 'package:gecko/models/chest_data.dart';
|
|
|
|
|
import 'package:gecko/models/g1_wallets_list.dart';
|
2022-08-23 00:25:16 +02:00
|
|
|
|
import 'package:gecko/models/widgets_keys.dart';
|
2021-12-23 15:13:58 +01:00
|
|
|
|
import 'package:gecko/providers/chest_provider.dart';
|
2022-06-14 21:55:33 +02:00
|
|
|
|
import 'package:gecko/providers/duniter_indexer.dart';
|
2022-05-29 04:30:03 +02:00
|
|
|
|
import 'package:gecko/providers/home.dart';
|
2022-02-18 18:57:03 +01:00
|
|
|
|
import 'package:gecko/providers/substrate_sdk.dart';
|
2021-12-23 15:13:58 +01:00
|
|
|
|
import 'package:gecko/providers/wallets_profiles.dart';
|
2021-01-08 01:20:03 +01:00
|
|
|
|
import 'package:flutter/material.dart';
|
2021-12-23 15:13:58 +01:00
|
|
|
|
import 'package:gecko/providers/my_wallets.dart';
|
2021-11-14 19:21:20 +01:00
|
|
|
|
import 'package:gecko/models/wallet_data.dart';
|
2022-12-10 08:16:38 +01:00
|
|
|
|
import 'package:gecko/widgets/commons/animated_text.dart';
|
|
|
|
|
import 'package:gecko/widgets/commons/common_elements.dart';
|
2021-11-21 06:36:12 +01:00
|
|
|
|
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
2021-11-14 19:21:20 +01:00
|
|
|
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
2022-05-31 18:23:56 +02:00
|
|
|
|
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
2021-11-21 01:50:05 +01:00
|
|
|
|
import 'package:gecko/screens/onBoarding/1.dart';
|
2021-11-23 04:11:45 +01:00
|
|
|
|
import 'package:gecko/screens/search.dart';
|
2021-01-28 15:26:26 +01:00
|
|
|
|
import 'package:gecko/screens/settings.dart';
|
2022-12-07 23:10:28 +01:00
|
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
2022-11-30 05:22:37 +01:00
|
|
|
|
|
2021-01-26 21:00:26 +01:00
|
|
|
|
import 'package:provider/provider.dart';
|
2022-08-14 20:02:02 +02:00
|
|
|
|
import 'package:gecko/screens/my_contacts.dart';
|
2021-01-08 00:12:22 +01:00
|
|
|
|
|
2022-12-07 23:10:28 +01:00
|
|
|
|
class HomeScreen extends StatefulWidget {
|
2021-12-23 12:36:09 +01:00
|
|
|
|
const HomeScreen({Key? key}) : super(key: key);
|
2021-11-14 19:21:20 +01:00
|
|
|
|
|
2022-12-07 23:10:28 +01:00
|
|
|
|
@override
|
|
|
|
|
State<HomeScreen> createState() => _HomeScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
final homeProviderInit =
|
|
|
|
|
Provider.of<HomeProvider>(context, listen: false);
|
|
|
|
|
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
|
|
|
|
final duniterIndexer =
|
|
|
|
|
Provider.of<DuniterIndexer>(context, listen: false);
|
|
|
|
|
final myWalletProvider =
|
|
|
|
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
|
|
|
|
|
|
|
|
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
|
|
|
|
|
2022-12-14 19:28:23 +01:00
|
|
|
|
// Check if versionData non compatible, drop everything
|
|
|
|
|
if (configBox.get('dataVersion') == null) {
|
|
|
|
|
configBox.put('dataVersion', dataVersion);
|
|
|
|
|
}
|
|
|
|
|
if (isWalletsExists && (configBox.get('dataVersion')) < dataVersion) {
|
|
|
|
|
if (!sub.sdkReady && !sub.sdkLoading) sub.initApi();
|
|
|
|
|
await infoPopup(context, "chestNotCompatibleMustReinstallGecko".tr());
|
|
|
|
|
await Hive.deleteBoxFromDisk('walletBox');
|
|
|
|
|
await Hive.deleteBoxFromDisk('chestBox');
|
|
|
|
|
chestBox = await Hive.openBox<ChestData>("chestBox");
|
|
|
|
|
await configBox.delete('defaultWallet');
|
|
|
|
|
if (!sub.sdkReady && !sub.sdkLoading) await sub.initApi();
|
|
|
|
|
await sub.deleteAllAccounts();
|
|
|
|
|
configBox.put('dataVersion', dataVersion);
|
|
|
|
|
myWalletProvider.reload();
|
|
|
|
|
} else {
|
|
|
|
|
if (!sub.sdkReady && !sub.sdkLoading) await sub.initApi();
|
|
|
|
|
}
|
2022-12-07 23:10:28 +01:00
|
|
|
|
|
2022-12-14 19:28:23 +01:00
|
|
|
|
if (sub.sdkReady && !sub.nodeConnected) {
|
2022-12-07 23:10:28 +01:00
|
|
|
|
walletBox = await Hive.openBox<WalletData>("walletBox");
|
|
|
|
|
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
|
|
|
|
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
|
|
|
|
contactsBox = await Hive.openBox<G1WalletsList>("contactsBox");
|
|
|
|
|
|
|
|
|
|
homeProviderInit.isWalletBoxInit = true;
|
|
|
|
|
myWalletProvider.reload();
|
|
|
|
|
|
|
|
|
|
duniterIndexer.getValidIndexerEndpoint();
|
|
|
|
|
|
|
|
|
|
await homeProviderInit.getValidEndpoints();
|
|
|
|
|
// await configBox.delete('isCacheChecked');
|
|
|
|
|
if (configBox.get('isCacheChecked') == null) {
|
|
|
|
|
configBox.put('isCacheChecked', false);
|
|
|
|
|
}
|
|
|
|
|
// log.d(await configBox.get('endpoint'));
|
|
|
|
|
|
|
|
|
|
// var connectivityResult =
|
|
|
|
|
// await (Connectivity().checkConnectivity());
|
|
|
|
|
|
|
|
|
|
// if (connectivityResult != ConnectivityResult.mobile &&
|
|
|
|
|
// connectivityResult != ConnectivityResult.wifi) {
|
|
|
|
|
// homeProvider.changeMessage(
|
|
|
|
|
// "notConnectedToInternet".tr(), 0);
|
|
|
|
|
// sub.nodeConnected = false;
|
|
|
|
|
// }
|
|
|
|
|
|
2023-01-31 03:14:01 +01:00
|
|
|
|
// Améliore ce code car il y a un bug: parfois l'app se croit hors ligne, alors que c'est faux, le téléphone est bien connecté à internet
|
2022-12-22 23:53:12 +01:00
|
|
|
|
// (GPT vscode extension fixed it for my...)
|
2022-12-07 23:10:28 +01:00
|
|
|
|
HomeProvider homeProvider =
|
|
|
|
|
Provider.of<HomeProvider>(context, listen: false);
|
|
|
|
|
Connectivity()
|
|
|
|
|
.onConnectivityChanged
|
|
|
|
|
.listen((ConnectivityResult result) async {
|
|
|
|
|
log.d('Network changed: $result');
|
|
|
|
|
if (result == ConnectivityResult.none) {
|
|
|
|
|
sub.nodeConnected = false;
|
|
|
|
|
await sub.sdk.api.setting.unsubscribeBestNumber();
|
|
|
|
|
homeProvider.changeMessage("notConnectedToInternet".tr(), 0);
|
|
|
|
|
sub.reload();
|
|
|
|
|
} else {
|
2022-12-22 23:53:12 +01:00
|
|
|
|
// Check if the phone is actually connected to the internet
|
|
|
|
|
var connectivityResult = await (Connectivity().checkConnectivity());
|
|
|
|
|
if (connectivityResult != ConnectivityResult.none) {
|
|
|
|
|
await sub.connectNode(context);
|
|
|
|
|
// Currency parameters
|
|
|
|
|
await sub.initCurrencyParameters();
|
2023-02-02 15:45:01 +01:00
|
|
|
|
// Indexer Blockchain start
|
|
|
|
|
getBlockStart();
|
2022-12-22 23:53:12 +01:00
|
|
|
|
}
|
2022-12-07 23:10:28 +01:00
|
|
|
|
}
|
2023-02-02 15:45:01 +01:00
|
|
|
|
|
2022-12-07 23:10:28 +01:00
|
|
|
|
});
|
|
|
|
|
// await sub.connectNode(ctx);
|
|
|
|
|
}
|
|
|
|
|
// _duniterIndexer.checkIndexerEndpointBackground();
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-08 00:12:22 +01:00
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2022-05-30 14:48:12 +02:00
|
|
|
|
homeContext = context;
|
2022-11-30 05:22:37 +01:00
|
|
|
|
|
2022-11-30 05:42:08 +01:00
|
|
|
|
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
2021-11-17 06:20:23 +01:00
|
|
|
|
Provider.of<ChestProvider>(context);
|
2022-08-06 02:22:41 +02:00
|
|
|
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
2021-11-14 03:12:07 +01:00
|
|
|
|
|
2021-03-08 00:32:18 +01:00
|
|
|
|
isTall = false;
|
|
|
|
|
ratio = 1;
|
|
|
|
|
if (MediaQuery.of(context).size.height >= 930) {
|
|
|
|
|
isTall = true;
|
|
|
|
|
ratio = 1.125;
|
|
|
|
|
}
|
2021-01-09 09:17:01 +01:00
|
|
|
|
return Scaffold(
|
2022-12-07 23:10:28 +01:00
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
|
drawer: Drawer(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
|
|
|
|
DrawerHeader(
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: orangeC,
|
|
|
|
|
),
|
|
|
|
|
child: Column(children: const <Widget>[
|
|
|
|
|
SizedBox(height: 0),
|
|
|
|
|
Image(
|
|
|
|
|
image: AssetImage('assets/icon/gecko_final.png'),
|
|
|
|
|
height: 130),
|
|
|
|
|
]),
|
2022-08-06 02:22:41 +02:00
|
|
|
|
),
|
2022-12-07 23:10:28 +01:00
|
|
|
|
ListTile(
|
|
|
|
|
key: keyParameters,
|
|
|
|
|
title: Text('parameters'.tr()),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) {
|
|
|
|
|
return SettingsScreen();
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
2022-12-14 19:21:51 +01:00
|
|
|
|
if (isWalletsExists)
|
|
|
|
|
ListTile(
|
|
|
|
|
key: keyContacts,
|
|
|
|
|
title: Text('contactsManagement'.tr()),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) {
|
|
|
|
|
return const ContactsScreen();
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
2022-12-07 23:10:28 +01:00
|
|
|
|
])),
|
|
|
|
|
Align(
|
|
|
|
|
alignment: FractionalOffset.bottomCenter,
|
|
|
|
|
child: Text('Ğecko v$appVersion')),
|
|
|
|
|
const SizedBox(height: 20)
|
|
|
|
|
],
|
|
|
|
|
),
|
2021-11-15 18:05:08 +01:00
|
|
|
|
),
|
2022-12-07 23:10:28 +01:00
|
|
|
|
backgroundColor: const Color(0xffF9F9F1),
|
|
|
|
|
body: isWalletsExists ? geckHome(context) : welcomeHome(context));
|
2021-11-21 01:50:05 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget geckHome(context) {
|
2022-11-30 05:42:08 +01:00
|
|
|
|
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
2022-12-07 23:10:28 +01:00
|
|
|
|
final homeProvider = Provider.of<HomeProvider>(context, listen: false);
|
2021-11-21 01:50:05 +01:00
|
|
|
|
Provider.of<ChestProvider>(context);
|
|
|
|
|
|
2022-08-06 02:22:41 +02:00
|
|
|
|
WalletsProfilesProvider historyProvider =
|
2021-11-30 01:25:48 +01:00
|
|
|
|
Provider.of<WalletsProfilesProvider>(context);
|
2022-12-02 10:23:21 +01:00
|
|
|
|
final statusBarHeight = MediaQuery.of(context).padding.top;
|
2021-11-21 01:50:05 +01:00
|
|
|
|
return Container(
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: AssetImage("assets/home/background.jpg"),
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child:
|
|
|
|
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
|
|
|
|
|
Stack(children: <Widget>[
|
|
|
|
|
Positioned(
|
|
|
|
|
top: statusBarHeight + 10,
|
|
|
|
|
left: 15,
|
|
|
|
|
child: Builder(
|
|
|
|
|
builder: (context) => IconButton(
|
2022-08-23 00:25:16 +02:00
|
|
|
|
key: keyDrawerMenu,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.menu,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 35,
|
2021-11-19 00:17:00 +01:00
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
2021-11-15 18:05:08 +01:00
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Align(
|
|
|
|
|
child:
|
|
|
|
|
Image(image: AssetImage('assets/home/header.png'), height: 210),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 15 * ratio),
|
2022-05-29 04:30:03 +02:00
|
|
|
|
child:
|
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
2022-06-01 21:00:17 +02:00
|
|
|
|
DefaultTextStyle(
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
shadows: <Shadow>[
|
|
|
|
|
Shadow(
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
blurRadius: 20,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
Shadow(
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
blurRadius: 20,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2022-08-06 02:22:41 +02:00
|
|
|
|
child: Consumer<HomeProvider>(builder: (context, homeP, _) {
|
2022-06-01 21:00:17 +02:00
|
|
|
|
return AnimatedFadeOutIn<String>(
|
2022-08-06 02:22:41 +02:00
|
|
|
|
data: homeP.homeMessage,
|
2022-06-01 21:00:17 +02:00
|
|
|
|
duration: const Duration(milliseconds: 100),
|
|
|
|
|
builder: (value) => Text(value),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
2022-05-29 04:30:03 +02:00
|
|
|
|
]),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
2022-02-18 00:20:21 +01:00
|
|
|
|
const SizedBox(height: 15),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
|
end: Alignment.bottomCenter,
|
|
|
|
|
colors: [
|
|
|
|
|
Colors.transparent,
|
|
|
|
|
Colors.black.withOpacity(0.9),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Column(children: <Widget>[
|
|
|
|
|
const Spacer(),
|
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
|
|
|
|
Column(children: <Widget>[
|
|
|
|
|
Container(
|
2022-08-06 02:22:41 +02:00
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
blurRadius: 2,
|
|
|
|
|
offset: Offset(1, 1.5),
|
|
|
|
|
spreadRadius: 0.5)
|
|
|
|
|
],
|
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: Material(
|
|
|
|
|
color: orangeC, // button color
|
|
|
|
|
child: InkWell(
|
2022-08-23 02:13:54 +02:00
|
|
|
|
key: keyOpenSearch,
|
2022-05-25 20:40:25 +02:00
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(18),
|
2021-11-23 04:11:45 +01:00
|
|
|
|
child: Image(
|
2022-05-25 20:40:25 +02:00
|
|
|
|
image:
|
|
|
|
|
const AssetImage('assets/home/loupe.png'),
|
|
|
|
|
height: 62 * ratio),
|
2021-11-23 04:11:45 +01:00
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
onTap: () {
|
2021-11-23 04:11:45 +01:00
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) {
|
|
|
|
|
return const SearchScreen();
|
|
|
|
|
}),
|
|
|
|
|
);
|
2021-11-21 01:50:05 +01:00
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
2021-11-19 03:18:39 +01:00
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
const SizedBox(height: 12),
|
2022-05-25 20:40:25 +02:00
|
|
|
|
Text(
|
2022-06-17 01:13:14 +02:00
|
|
|
|
"searchWallet".tr(),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
2022-05-25 20:40:25 +02:00
|
|
|
|
fontSize: 15 * ratio,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
fontWeight: FontWeight.w500),
|
|
|
|
|
)
|
2021-11-19 03:18:39 +01:00
|
|
|
|
]),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
const SizedBox(width: 120),
|
|
|
|
|
Column(children: <Widget>[
|
|
|
|
|
Container(
|
2022-08-06 02:22:41 +02:00
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
blurRadius: 2,
|
|
|
|
|
offset: Offset(1, 1.5),
|
|
|
|
|
spreadRadius: 0.5)
|
|
|
|
|
],
|
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: ClipOval(
|
2022-08-23 02:13:54 +02:00
|
|
|
|
key: keyOpenWalletsHomme,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: Material(
|
2022-12-07 23:10:28 +01:00
|
|
|
|
color: homeProvider.isWalletBoxInit
|
|
|
|
|
? orangeC
|
|
|
|
|
: Colors.grey[500], // button color
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: InkWell(
|
2022-12-07 23:10:28 +01:00
|
|
|
|
onTap: !homeProvider.isWalletBoxInit
|
|
|
|
|
? null
|
|
|
|
|
: () async {
|
|
|
|
|
WalletData? defaultWallet =
|
|
|
|
|
myWalletProvider.getDefaultWallet();
|
|
|
|
|
String? pin;
|
|
|
|
|
if (myWalletProvider.pinCode == '') {
|
|
|
|
|
pin = await Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (homeContext) {
|
|
|
|
|
return UnlockingWallet(
|
|
|
|
|
wallet: defaultWallet);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (pin != null ||
|
|
|
|
|
myWalletProvider.pinCode != '') {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) {
|
|
|
|
|
return const WalletsHome();
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
// log.d(_myWalletProvider.pinCode);
|
|
|
|
|
|
|
|
|
|
// Navigator.pushNamed(
|
|
|
|
|
// context, '/mywallets')));
|
|
|
|
|
},
|
2022-05-25 20:40:25 +02:00
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(18),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: Image(
|
2022-05-25 20:40:25 +02:00
|
|
|
|
image: const AssetImage(
|
|
|
|
|
'assets/home/wallet.png'),
|
2022-12-07 23:10:28 +01:00
|
|
|
|
height: 68 * ratio))),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 12),
|
2022-05-25 20:40:25 +02:00
|
|
|
|
Text(
|
2022-06-17 01:13:14 +02:00
|
|
|
|
"manageWallets".tr(),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
2022-05-25 20:40:25 +02:00
|
|
|
|
fontSize: 15 * ratio,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
fontWeight: FontWeight.w500),
|
|
|
|
|
)
|
|
|
|
|
])
|
|
|
|
|
]),
|
|
|
|
|
Padding(
|
2022-05-25 20:40:25 +02:00
|
|
|
|
padding: EdgeInsets.only(top: 35 * ratio),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(children: <Widget>[
|
|
|
|
|
Container(
|
2022-08-06 02:22:41 +02:00
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
blurRadius: 2,
|
|
|
|
|
offset: Offset(1, 1.5),
|
|
|
|
|
spreadRadius: 0.5)
|
|
|
|
|
],
|
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: Material(
|
|
|
|
|
color: orangeC, // button color
|
|
|
|
|
child: InkWell(
|
2022-05-25 20:40:25 +02:00
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(18),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: Image(
|
2022-05-25 20:40:25 +02:00
|
|
|
|
image: const AssetImage(
|
2021-11-21 01:50:05 +01:00
|
|
|
|
'assets/home/qrcode.png'),
|
2022-05-25 20:40:25 +02:00
|
|
|
|
height: 68 * ratio)),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
onTap: () async {
|
2022-08-06 02:22:41 +02:00
|
|
|
|
await historyProvider.scan(context);
|
2021-11-21 01:50:05 +01:00
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 12),
|
2022-05-25 20:40:25 +02:00
|
|
|
|
Text(
|
2022-06-17 01:13:14 +02:00
|
|
|
|
"scanQRCode".tr(),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
2022-05-25 20:40:25 +02:00
|
|
|
|
fontSize: 15 * ratio,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
fontWeight: FontWeight.w500),
|
2021-11-19 03:18:39 +01:00
|
|
|
|
)
|
2021-11-21 01:50:05 +01:00
|
|
|
|
])
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: isTall ? 80 : 40)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget welcomeHome(context) {
|
2022-12-02 10:23:21 +01:00
|
|
|
|
final statusBarHeight = MediaQuery.of(context).padding.top;
|
2021-11-21 01:50:05 +01:00
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: AssetImage("assets/home/background.jpg"),
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child:
|
|
|
|
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
|
|
|
|
|
Stack(children: <Widget>[
|
|
|
|
|
Positioned(
|
|
|
|
|
top: statusBarHeight + 10,
|
|
|
|
|
left: 15,
|
|
|
|
|
child: Builder(
|
|
|
|
|
builder: (context) => IconButton(
|
2022-08-23 00:25:16 +02:00
|
|
|
|
key: keyDrawerMenu,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.menu,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 35,
|
2021-11-19 03:18:39 +01:00
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Align(
|
|
|
|
|
child:
|
|
|
|
|
Image(image: AssetImage('assets/home/header.png'), height: 210),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 1 * ratio),
|
2022-05-20 15:15:29 +02:00
|
|
|
|
child:
|
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
|
|
|
|
Text(
|
2022-06-17 01:13:14 +02:00
|
|
|
|
"fastAppDescription".tr(args: [currencyName]),
|
2022-05-20 15:15:29 +02:00
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
shadows: <Shadow>[
|
|
|
|
|
Shadow(
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
blurRadius: 20,
|
|
|
|
|
color: Colors.black,
|
2021-11-19 03:18:39 +01:00
|
|
|
|
),
|
2022-05-20 15:15:29 +02:00
|
|
|
|
Shadow(
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
blurRadius: 20,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
2021-11-15 18:05:08 +01:00
|
|
|
|
),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
Expanded(
|
2021-12-24 15:27:38 +01:00
|
|
|
|
flex: 1,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
|
end: Alignment.bottomCenter,
|
|
|
|
|
colors: [
|
|
|
|
|
Colors.transparent,
|
|
|
|
|
Colors.black.withOpacity(0.9),
|
|
|
|
|
],
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
2021-12-24 15:27:38 +01:00
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: ConstrainedBox(
|
|
|
|
|
constraints: const BoxConstraints(maxWidth: 480),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: Column(children: <Widget>[
|
|
|
|
|
const Spacer(),
|
|
|
|
|
Row(children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Stack(children: <Widget>[
|
|
|
|
|
const Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 55),
|
|
|
|
|
child: Image(
|
|
|
|
|
image: AssetImage('assets/home/gecko-bienvenue.png'),
|
|
|
|
|
height: 220,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Positioned(
|
|
|
|
|
left: 180,
|
2022-06-17 01:13:14 +02:00
|
|
|
|
child: bubbleSpeak("noLizard".tr()),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
|
|
|
|
const Positioned(
|
|
|
|
|
left: 200,
|
|
|
|
|
top: 60,
|
|
|
|
|
child: Image(
|
|
|
|
|
image: AssetImage('assets/home/bout_de_bulle.png'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 410,
|
|
|
|
|
height: 70,
|
2022-09-05 08:12:24 +02:00
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
key: keyOnboardingNewChest,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
style: ElevatedButton.styleFrom(
|
2022-09-05 08:12:24 +02:00
|
|
|
|
foregroundColor: Colors.white, elevation: 4,
|
|
|
|
|
backgroundColor: orangeC, // foreground
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) {
|
2022-05-23 10:53:44 +02:00
|
|
|
|
return const OnboardingStepOne();
|
2021-11-21 01:50:05 +01:00
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
2022-06-17 01:13:14 +02:00
|
|
|
|
child: Text(
|
|
|
|
|
'createWallet'.tr(),
|
2022-06-17 20:18:54 +02:00
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 24, fontWeight: FontWeight.w600),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 25 * ratio),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 410,
|
|
|
|
|
height: 70,
|
|
|
|
|
child: OutlinedButton(
|
2022-08-23 00:25:16 +02:00
|
|
|
|
key: keyRestoreChest,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
style: OutlinedButton.styleFrom(
|
2022-09-12 12:38:32 +02:00
|
|
|
|
side: const BorderSide(width: 4, color: orangeC)),
|
2021-11-21 01:50:05 +01:00
|
|
|
|
onPressed: () {
|
2021-11-21 06:36:12 +01:00
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return const RestoreChest();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
2021-11-21 01:50:05 +01:00
|
|
|
|
},
|
|
|
|
|
child: Text(
|
2022-06-17 01:13:14 +02:00
|
|
|
|
"restoreWallet".tr(),
|
2022-09-12 12:38:32 +02:00
|
|
|
|
style: const TextStyle(
|
2021-11-21 01:50:05 +01:00
|
|
|
|
fontSize: 24,
|
|
|
|
|
color: orangeC,
|
|
|
|
|
fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: isTall ? 100 : 50)
|
|
|
|
|
]),
|
|
|
|
|
),
|
2021-12-24 15:27:38 +01:00
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
2021-11-21 01:50:05 +01:00
|
|
|
|
]),
|
|
|
|
|
);
|
2021-02-22 19:44:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-23 12:36:09 +01:00
|
|
|
|
Widget bubbleSpeak(String text, {double? long, Key? textKey}) {
|
2021-11-21 01:50:05 +01:00
|
|
|
|
return Bubble(
|
|
|
|
|
padding: long == null
|
|
|
|
|
? const BubbleEdges.all(20)
|
|
|
|
|
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
|
|
|
|
|
elevation: 5,
|
2022-05-29 00:00:57 +02:00
|
|
|
|
color: backgroundColor,
|
2021-11-21 01:50:05 +01:00
|
|
|
|
child: Text(
|
|
|
|
|
text,
|
|
|
|
|
key: textKey,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
color: Colors.black, fontSize: 21, fontWeight: FontWeight.w400),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|