Merge branch 'multiChest'

This commit is contained in:
poka 2021-11-18 19:11:27 +01:00
commit 679d1511c1
141 changed files with 4969 additions and 1463 deletions

29
analysis_options.yaml Normal file
View File

@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -66,6 +66,9 @@ android {
// TODO: Add your own signing config for the release build. // TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works. // Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
} }

7
android/app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,7 @@
-ignorewarnings
-keep class * {
public private *;
}
-dontwarn org.xmlpull.v1.XmlPullParser
-dontwarn org.xmlpull.v1.XmlSerializer
-keep class org.xmlpull.v1.* {*;}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/avatars/0.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
assets/avatars/1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
assets/avatars/2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
assets/avatars/3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
assets/avatars/trunc/0.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
assets/avatars/trunc/1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/avatars/trunc/2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/chests/0.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
assets/chests/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
assets/chests/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
assets/chests/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
assets/chests/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
assets/chests/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
assets/chests/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
assets/chests/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
assets/chests/cesium.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
assets/chests/config.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
assets/chests/miniChests.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
assets/chests/secret_code.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
assets/chests/vector.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

BIN
assets/icon/gecko_final.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 84 KiB

BIN
assets/icon/gecko_flat.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -8,13 +9,12 @@ import 'package:shared_preferences/shared_preferences.dart';
// Files paths // Files paths
Directory appPath; Directory appPath;
WalletData defaultWallet;
String appVersion; String appVersion;
SharedPreferences prefs; SharedPreferences prefs;
String endPointGVA; String endPointGVA;
int ramSys; int ramSys;
Box<WalletData> walletBox; Box<WalletData> walletBox;
Box chestBox; Box<ChestData> chestBox;
Box configBox; Box configBox;
// String cesiumPod = "https://g1.data.le-sou.org"; // String cesiumPod = "https://g1.data.le-sou.org";
@ -28,7 +28,7 @@ double ratio;
var log = Logger(); var log = Logger();
// Colors // Colors
Color orangeC = Color(0xffD28928); Color orangeC = const Color(0xffd07316);
Color yellowC = Color(0xffFFD68E); Color yellowC = const Color(0xffFFD68E);
Color floattingYellow = Color(0xffEFEFBF); Color floattingYellow = const Color(0xffEFEFBF);
Color backgroundColor = Color(0xFFF5F5F5); Color backgroundColor = const Color(0xFFF5F5F5);

View File

@ -13,21 +13,26 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
// ignore_for_file: avoid_print
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/cesiumPlus.dart'; import 'package:gecko/models/cesium_plus.dart';
import 'package:gecko/models/changePin.dart'; import 'package:gecko/models/change_pin.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/chest_provider.dart';
import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:gecko/screens/home.dart'; import 'package:gecko/screens/home.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/walletsHome.dart'; import 'package:gecko/screens/myWallets/wallets_home.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
@ -36,14 +41,15 @@ import 'package:flutter/foundation.dart';
import 'package:responsive_framework/responsive_framework.dart'; import 'package:responsive_framework/responsive_framework.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:flutter_driver/driver_extension.dart';
final bool enableSentry = true; const bool enableSentry = true;
Future<void> main() async { Future<void> main() async {
enableFlutterDriverExtension();
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
HomeProvider _homeProvider = HomeProvider(); HomeProvider _homeProvider = HomeProvider();
MyWalletsProvider _walletsProvider = MyWalletsProvider();
appPath = await getApplicationDocumentsDirectory(); appPath = await getApplicationDocumentsDirectory();
await _homeProvider.createDefaultAvatar(); await _homeProvider.createDefaultAvatar();
appVersion = await _homeProvider.getAppVersion(); appVersion = await _homeProvider.getAppVersion();
@ -52,12 +58,11 @@ Future<void> main() async {
// Configure Hive and open boxes // Configure Hive and open boxes
await Hive.initFlutter(appPath.path); await Hive.initFlutter(appPath.path);
Hive.registerAdapter(WalletDataAdapter()); Hive.registerAdapter(WalletDataAdapter());
Hive.registerAdapter(ChestDataAdapter());
walletBox = await Hive.openBox<WalletData>("walletBox"); walletBox = await Hive.openBox<WalletData>("walletBox");
chestBox = await Hive.openBox("chestBox"); chestBox = await Hive.openBox<ChestData>("chestBox");
configBox = await Hive.openBox("configBox"); configBox = await Hive.openBox("configBox");
_walletsProvider.getDefaultWallet();
// final HiveStore _store = // final HiveStore _store =
// await HiveStore.open(path: '${appPath.path}/gqlCache'); // await HiveStore.open(path: '${appPath.path}/gqlCache');
@ -102,12 +107,14 @@ Future<void> main() async {
} else { } else {
print('Debug mode enabled: No sentry alerte'); print('Debug mode enabled: No sentry alerte');
HttpOverrides.global = MyHttpOverrides();
runApp(Gecko(endPointGVA)); runApp(Gecko(endPointGVA));
} }
} }
class Gecko extends StatelessWidget { class Gecko extends StatelessWidget {
Gecko(this.randomEndpoint); const Gecko(this.randomEndpoint, {Key key}) : super(key: key);
final String randomEndpoint; final String randomEndpoint;
@override @override
@ -132,6 +139,7 @@ class Gecko extends StatelessWidget {
ChangeNotifierProvider(create: (_) => HomeProvider()), ChangeNotifierProvider(create: (_) => HomeProvider()),
ChangeNotifierProvider(create: (_) => HistoryProvider('')), ChangeNotifierProvider(create: (_) => HistoryProvider('')),
ChangeNotifierProvider(create: (_) => MyWalletsProvider()), ChangeNotifierProvider(create: (_) => MyWalletsProvider()),
ChangeNotifierProvider(create: (_) => ChestProvider()),
ChangeNotifierProvider(create: (_) => GenerateWalletsProvider()), ChangeNotifierProvider(create: (_) => GenerateWalletsProvider()),
ChangeNotifierProvider(create: (_) => WalletOptionsProvider()), ChangeNotifierProvider(create: (_) => WalletOptionsProvider()),
ChangeNotifierProvider(create: (_) => ChangePinProvider()), ChangeNotifierProvider(create: (_) => ChangePinProvider()),
@ -146,28 +154,28 @@ class Gecko extends StatelessWidget {
minWidth: 480, minWidth: 480,
defaultScale: true, defaultScale: true,
breakpoints: [ breakpoints: [
ResponsiveBreakpoint.resize(480, name: MOBILE), const ResponsiveBreakpoint.resize(480, name: MOBILE),
ResponsiveBreakpoint.autoScale(800, name: TABLET), const ResponsiveBreakpoint.autoScale(800, name: TABLET),
ResponsiveBreakpoint.resize(1000, name: DESKTOP), const ResponsiveBreakpoint.resize(1000, name: DESKTOP),
], ],
background: Container(color: backgroundColor)), background: Container(color: backgroundColor)),
title: 'Ğecko', title: 'Ğecko',
theme: ThemeData( theme: ThemeData(
appBarTheme: AppBarTheme( appBarTheme: const AppBarTheme(
color: const Color(0xffFFD58D), color: Color(0xffFFD58D),
foregroundColor: const Color(0xFF000000), foregroundColor: Color(0xFF000000),
), ),
primaryColor: Color(0xffFFD58D), primaryColor: const Color(0xffFFD58D),
textTheme: TextTheme( textTheme: const TextTheme(
bodyText1: TextStyle(), bodyText1: TextStyle(),
bodyText2: TextStyle(), bodyText2: TextStyle(),
).apply( ).apply(
bodyColor: Color(0xff855F2D), bodyColor: const Color(0xFF000000),
), ),
colorScheme: ColorScheme.fromSwatch() colorScheme: ColorScheme.fromSwatch()
.copyWith(secondary: Colors.grey[850]), .copyWith(secondary: Colors.grey[850]),
), ),
home: HomeScreen(), home: const HomeScreen(),
initialRoute: "/", initialRoute: "/",
routes: { routes: {
'/mywallets': (context) => WalletsHome(), '/mywallets': (context) => WalletsHome(),
@ -176,3 +184,13 @@ class Gecko extends StatelessWidget {
)); ));
} }
} }
// This http overriding is needed to fix fail certifcat checking for Duniter node on old Android version
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}

View File

@ -7,10 +7,6 @@ import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
class CesiumPlusProvider with ChangeNotifier { class CesiumPlusProvider with ChangeNotifier {
// String pubkey = '';
// CesiumPlusProvider(this.pubkey);
var decodedBytes;
var avatar64;
TextEditingController cesiumName = TextEditingController(); TextEditingController cesiumName = TextEditingController();
int iAvatar = 0; int iAvatar = 0;
bool isComplete = false; bool isComplete = false;

View File

@ -1,38 +0,0 @@
import 'package:dubp/dubp.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:gecko/globals.dart';
class ChangePinProvider with ChangeNotifier {
bool ischangedPin = false;
TextEditingController newPin = new TextEditingController();
Future<NewWallet> get badWallet => null;
Future<NewWallet> changePin(_name, _oldPin) async {
try {
final _dewif = chestBox.get(0);
NewWallet newWalletFile = await DubpRust.changeDewifPin(
dewif: _dewif,
oldPin: _oldPin,
);
newPin.text = newWalletFile.pin;
ischangedPin = true;
notifyListeners();
return newWalletFile;
} catch (e) {
log.e('Impossible de changer le code PIN.');
return badWallet;
}
}
Future storeWallet(context, _name, NewWallet _newWalletFile) async {
chestBox.put(0, _newWalletFile.dewif);
Navigator.pop(context);
return _name;
}
}

View File

@ -0,0 +1,43 @@
import 'package:dubp/dubp.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:gecko/globals.dart';
class ChangePinProvider with ChangeNotifier {
bool ischangedPin = false;
TextEditingController newPin = TextEditingController();
String pinToGive;
Future<NewWallet> get badWallet => null;
Future<NewWallet> changePin(String _oldPin) async {
try {
final _dewif = chestBox.get(configBox.get('currentChest')).dewif;
NewWallet newWalletFile = await DubpRust.changeDewifPin(
dewif: _dewif,
oldPin: _oldPin.toUpperCase(),
);
newPin.text = pinToGive = newWalletFile.pin;
ischangedPin = true;
notifyListeners();
return newWalletFile;
} catch (e) {
log.e('Impossible de changer le code PIN.');
return badWallet;
}
}
void storeNewPinChest(context, NewWallet _newWalletFile) {
// ChestData currentChest = chestBox.getAt(configBox.get('currentChest'));
// currentChest.dewif = _newWalletFile.dewif;
// await chestBox.add(currentChest);
chestBox.get(configBox.get('currentChest')).dewif = _newWalletFile.dewif;
Navigator.pop(context, pinToGive);
pinToGive = '';
}
}

View File

@ -0,0 +1,40 @@
import 'dart:io';
import 'package:hive_flutter/hive_flutter.dart';
part 'chest_data.g.dart';
@HiveType(typeId: 1)
class ChestData extends HiveObject {
@HiveField(0)
String dewif;
@HiveField(2)
String name;
@HiveField(3)
int defaultWallet;
@HiveField(4)
String imageName;
@HiveField(5)
File imageFile;
@HiveField(6)
bool isCesium;
ChestData({
this.dewif,
this.name,
this.defaultWallet,
this.imageName,
this.imageFile,
this.isCesium,
});
@override
String toString() {
return name;
}
}

View File

@ -0,0 +1,56 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'chest_data.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ChestDataAdapter extends TypeAdapter<ChestData> {
@override
final int typeId = 1;
@override
ChestData read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return ChestData(
dewif: fields[0] as String,
name: fields[2] as String,
defaultWallet: fields[3] as int,
imageName: fields[4] as String,
imageFile: fields[5] as File,
isCesium: fields[6] as bool,
);
}
@override
void write(BinaryWriter writer, ChestData obj) {
writer
..writeByte(6)
..writeByte(0)
..write(obj.dewif)
..writeByte(2)
..write(obj.name)
..writeByte(3)
..write(obj.defaultWallet)
..writeByte(4)
..write(obj.imageName)
..writeByte(5)
..write(obj.imageFile)
..writeByte(6)
..write(obj.isCesium);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ChestDataAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}

View File

@ -0,0 +1,57 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
class ChestProvider with ChangeNotifier {
void rebuildWidget() {
notifyListeners();
}
Future deleteChest(context, ChestData _chest) async {
final bool _answer = await _confirmDeletingChest(context, _chest.name);
if (_answer) {
await chestBox.delete(_chest.key);
if (chestBox.isEmpty) {
await configBox.put('currentChest', 0);
} else {
int lastChest = chestBox.toMap().keys.first;
await configBox.put('currentChest', lastChest);
}
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
notifyListeners();
}
}
Future<bool> _confirmDeletingChest(context, String _walletName) async {
return showDialog<bool>(
context: context,
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: Text(
'Êtes-vous sûr de vouloir supprimer le coffre "$_walletName" ?'),
actions: <Widget>[
TextButton(
child: const Text("Non", key: Key('cancelDeleting')),
onPressed: () {
Navigator.pop(context, false);
},
),
TextButton(
child: const Text("Oui", key: Key('confirmDeleting')),
onPressed: () {
Navigator.pop(context, true);
},
),
],
);
},
);
}
}

View File

@ -5,7 +5,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:pdf/pdf.dart'; import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw; import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
@ -38,14 +39,41 @@ class GenerateWalletsProvider with ChangeNotifier {
bool canImport = false; bool canImport = false;
bool isPinChanged = false; bool isPinChanged = false;
void storeHDWChest( Future storeHDWChest(
NewWallet _wallet, String _name, BuildContext context) async { NewWallet _wallet, String _name, BuildContext context) async {
WalletData myWallet = int chestNumber = 0;
WalletData(chest: 0, number: 0, name: _name, derivation: 3); chestBox.toMap().forEach((key, value) {
walletBox.add(myWallet); if (!value.isCesium) {
chestBox.put(0, _wallet.dewif); chestNumber++;
configBox.put('currentChest', 0); }
// walletBox.get(1) });
String chestName;
if (chestNumber == 0) {
chestName = 'Coffre à Ğecko';
} else {
chestName = 'Coffre à Ğecko ${chestNumber + 1}';
}
ChestData thisChest = ChestData(
dewif: _wallet.dewif,
name: chestName,
defaultWallet: 0,
imageName: '${chestNumber % 8}.png',
isCesium: false,
);
await chestBox.add(thisChest);
int chestKey = chestBox.keys.last;
WalletData myWallet = WalletData(
chest: chestKey,
number: 0,
name: _name,
derivation: 3,
imageName: '0.png');
await walletBox.add(myWallet);
await configBox.put('currentChest', chestKey);
notifyListeners();
} }
void checkAskedWord(String inputWord, String _mnemo) { void checkAskedWord(String inputWord, String _mnemo) {
@ -81,7 +109,7 @@ class GenerateWalletsProvider with ChangeNotifier {
} }
int getRandomInt() { int getRandomInt() {
var rng = new Random(); var rng = Random();
return rng.nextInt(12); return rng.nextInt(12);
} }
@ -112,7 +140,7 @@ class GenerateWalletsProvider with ChangeNotifier {
Future<String> generateMnemonic() async { Future<String> generateMnemonic() async {
try { try {
generatedMnemonic = await DubpRust.genMnemonic(language: Language.french); generatedMnemonic = await DubpRust.genMnemonic(language: Language.french);
this.actualWallet = await generateWallet(this.generatedMnemonic); actualWallet = await generateWallet(generatedMnemonic);
walletIsGenerated = true; walletIsGenerated = true;
} catch (e) { } catch (e) {
log.e(e); log.e(e);
@ -122,7 +150,7 @@ class GenerateWalletsProvider with ChangeNotifier {
Future<NewWallet> generateWallet(generatedMnemonic) async { Future<NewWallet> generateWallet(generatedMnemonic) async {
try { try {
this.actualWallet = await DubpRust.genWalletFromMnemonic( actualWallet = await DubpRust.genWalletFromMnemonic(
language: Language.french, language: Language.french,
mnemonic: generatedMnemonic, mnemonic: generatedMnemonic,
secretCodeType: SecretCodeType.letters, secretCodeType: SecretCodeType.letters,
@ -132,10 +160,10 @@ class GenerateWalletsProvider with ChangeNotifier {
} }
mnemonicController.text = generatedMnemonic; mnemonicController.text = generatedMnemonic;
pin.text = this.actualWallet.pin; pin.text = actualWallet.pin;
// notifyListeners(); // notifyListeners();
return this.actualWallet; return actualWallet;
} }
Future<NewWallet> changePinCode({bool reload}) async { Future<NewWallet> changePinCode({bool reload}) async {
@ -158,7 +186,7 @@ class GenerateWalletsProvider with ChangeNotifier {
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData()); final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
final pdf = pw.Document(); final pdf = pw.Document();
const imageProvider = const AssetImage('assets/icon/gecko_final.png'); const imageProvider = AssetImage('assets/icon/gecko_final.png');
final geckoLogo = await flutterImageProvider(imageProvider); final geckoLogo = await flutterImageProvider(imageProvider);
pdf.addPage( pdf.addPage(
@ -203,13 +231,15 @@ class GenerateWalletsProvider with ChangeNotifier {
log.d(_walletPubkey); log.d(_walletPubkey);
} }
Future importWallet(context, _cesiumID, _cesiumPWD) async { Future importCesiumWallet() async {
// String _walletPubkey = await DubpRust.getLegacyPublicKey( // String _walletPubkey = await DubpRust.getLegacyPublicKey(
// salt: _cesiumID, password: _cesiumPWD); // salt: _cesiumID, password: _cesiumPWD);
// String shortPubkey = truncate(_walletPubkey, 9, // String shortPubkey = truncate(_walletPubkey, 9,
// omission: "...", position: TruncatePosition.end); // omission: "...", position: TruncatePosition.end);
// await storeWallet( // await storeWallet(
// actualWallet, 'Portefeuille Cesium - $shortPubkey', context); // actualWallet, 'Portefeuille Cesium - $shortPubkey', context);
// NewWallet myCesiumWallet = await DubpRust.genWalletFromDeprecatedSaltPassword(salt: _cesiumID, password: _cesiumPWD);
cesiumID.text = ''; cesiumID.text = '';
cesiumPWD.text = ''; cesiumPWD.text = '';
cesiumPubkey.text = ''; cesiumPubkey.text = '';
@ -218,6 +248,33 @@ class GenerateWalletsProvider with ChangeNotifier {
pin.text = ''; pin.text = '';
isCesiumIDVisible = false; isCesiumIDVisible = false;
isCesiumPWDVisible = false; isCesiumPWDVisible = false;
int chestNumber = 0;
chestBox.toMap().forEach((key, value) {
if (value.isCesium) {
chestNumber++;
}
});
String chestName;
if (chestNumber == 0) {
chestName = 'Coffre à Césium';
} else {
chestName = 'Coffre à Césium ${chestNumber + 1}';
}
ChestData cesiumChest = ChestData(
dewif: actualWallet.dewif,
name: chestName,
imageName: 'cesium.png',
defaultWallet: 0,
isCesium: true);
await chestBox.add(cesiumChest).then((value) => null);
int chestKey = await chestBox.toMap().keys.last;
// chestBox.toMap().
await configBox.put('currentChest', chestKey);
notifyListeners(); notifyListeners();
} }

View File

@ -3,6 +3,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/history.dart'; import 'package:gecko/screens/history.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:jdenticon_dart/jdenticon_dart.dart'; import 'package:jdenticon_dart/jdenticon_dart.dart';
@ -40,7 +42,7 @@ class HistoryProvider with ChangeNotifier {
return 'false'; return 'false';
} }
if (barcode != null) { if (barcode != null) {
this.outputPubkey.text = barcode; outputPubkey.text = barcode;
isPubkey(context, barcode); isPubkey(context, barcode);
} else { } else {
return 'false'; return 'false';
@ -49,8 +51,12 @@ class HistoryProvider with ChangeNotifier {
} }
Future<String> pay(BuildContext context, String pinCode) async { Future<String> pay(BuildContext context, String pinCode) async {
// MyWalletsProvider _myWalletProvider = MyWalletsProvider(); MyWalletsProvider _myWalletModel = MyWalletsProvider();
String dewif = chestBox.get(0); int currentChest = configBox.get('currentChest');
WalletData defaultWallet = _myWalletModel.getDefaultWallet(currentChest);
String dewif = chestBox.get(currentChest).dewif;
try { try {
await DubpRust.simplePaymentFromTransparentAccount( await DubpRust.simplePaymentFromTransparentAccount(
accountIndex: defaultWallet.derivation, accountIndex: defaultWallet.derivation,
@ -71,7 +77,7 @@ class HistoryProvider with ChangeNotifier {
String isPubkey(context, pubkey, {bool goHistory}) { String isPubkey(context, pubkey, {bool goHistory}) {
HomeProvider _homeProvider = HomeProvider _homeProvider =
Provider.of<HomeProvider>(context, listen: false); Provider.of<HomeProvider>(context, listen: false);
final RegExp regExp = new RegExp( final RegExp regExp = RegExp(
r'^[a-zA-Z0-9]+$', r'^[a-zA-Z0-9]+$',
caseSensitive: false, caseSensitive: false,
multiLine: false, multiLine: false,
@ -85,9 +91,9 @@ class HistoryProvider with ChangeNotifier {
this.pubkey = pubkey; this.pubkey = pubkey;
getShortPubkey(pubkey); getShortPubkey(pubkey);
this.outputPubkey.text = pubkey; outputPubkey.text = pubkey;
if (goHistory == null) goHistory = false; goHistory ??= false;
if (goHistory) { if (goHistory) {
isHistoryScreen = true; isHistoryScreen = true;
@ -138,13 +144,13 @@ class HistoryProvider with ChangeNotifier {
var transBC = []; var transBC = [];
int i = 0; int i = 0;
final currentBase = 0; const currentBase = 0;
double currentUD = 10.54; double currentUD = 10.54;
for (final trans in txs) { for (final trans in txs) {
var direction = trans['direction']; var direction = trans['direction'];
final transaction = trans['node']; final transaction = trans['node'];
var output; String output;
if (direction == "RECEIVED") { if (direction == "RECEIVED") {
for (String line in transaction['outputs']) { for (String line in transaction['outputs']) {
if (line.contains(_pubkey)) { if (line.contains(_pubkey)) {
@ -235,15 +241,15 @@ class HistoryProvider with ChangeNotifier {
} else { } else {
_message = "Vous êtes connecté au noeud\n${endPointGVA.split('/')[2]}"; _message = "Vous êtes connecté au noeud\n${endPointGVA.split('/')[2]}";
} }
final snackBar = final snackBar = SnackBar(
SnackBar(content: Text(_message), duration: Duration(seconds: 2)); content: Text(_message), duration: const Duration(seconds: 2));
isFirstBuild = false; isFirstBuild = false;
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }
} }
void resetdHistory() { void resetdHistory() {
this.outputPubkey.text = ''; outputPubkey.text = '';
notifyListeners(); notifyListeners();
} }
@ -253,7 +259,7 @@ class HistoryProvider with ChangeNotifier {
} }
snackCopyKey(context) { snackCopyKey(context) {
final snackBar = SnackBar( const snackBar = SnackBar(
content: content:
Text("Cette clé publique a été copié dans votre presse-papier."), Text("Cette clé publique a été copié dans votre presse-papier."),
duration: Duration(seconds: 2)); duration: Duration(seconds: 2));
@ -273,8 +279,4 @@ class HistoryProvider with ChangeNotifier {
String generateIdenticon(String _pubkey) { String generateIdenticon(String _pubkey) {
return Jdenticon.toSvg(_pubkey); return Jdenticon.toSvg(_pubkey);
} }
// num getBalance(_pubkey) {
// getBalance(_pubkey);
// }
} }

View File

@ -9,14 +9,14 @@ import 'package:flutter/services.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/history.dart'; import 'package:gecko/screens/history.dart';
import 'package:gecko/screens/myWallets/walletsHome.dart'; import 'package:gecko/screens/myWallets/wallets_home.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
class HomeProvider with ChangeNotifier { class HomeProvider with ChangeNotifier {
int _currentIndex = 0; int _currentIndex = 0;
bool isSearching; bool isSearching;
Icon searchIcon = Icon(Icons.search); Icon searchIcon = const Icon(Icons.search);
final TextEditingController searchQuery = new TextEditingController(); final TextEditingController searchQuery = TextEditingController();
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850])); Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
Widget appBarExplorer = Widget appBarExplorer =
Text('Explorateur', style: TextStyle(color: Colors.grey[850])); Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
@ -57,7 +57,7 @@ class HomeProvider with ChangeNotifier {
String _endpoint; String _endpoint;
int _statusCode = 0; int _statusCode = 0;
final _client = new HttpClient(); final _client = HttpClient();
_client.connectionTimeout = const Duration(milliseconds: 1000); _client.connectionTimeout = const Duration(milliseconds: 1000);
do { do {

View File

@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
class MyWalletsProvider with ChangeNotifier { class MyWalletsProvider with ChangeNotifier {
List<WalletData> listWallets = []; List<WalletData> listWallets = [];
@ -18,13 +18,7 @@ class MyWalletsProvider with ChangeNotifier {
} }
bool checkIfWalletExist() { bool checkIfWalletExist() {
if (appPath == null) { if (chestBox.isEmpty) {
return false;
}
final List _walletList = readAllWallets(0);
if (_walletList.isEmpty) {
log.i('No wallets detected'); log.i('No wallets detected');
return false; return false;
} else { } else {
@ -47,27 +41,25 @@ class MyWalletsProvider with ChangeNotifier {
if (_id.isEmpty) return WalletData(); if (_id.isEmpty) return WalletData();
int _chest = _id[0]; int _chest = _id[0];
int _nbr = _id[1]; int _nbr = _id[1];
var _targetedWallet; WalletData _targetedWallet;
walletBox.toMap().forEach((key, value) { walletBox.toMap().forEach((key, value) {
if (value.chest == _chest && value.number == _nbr) { if (value.chest == _chest && value.number == _nbr) {
_targetedWallet = value; _targetedWallet = value;
return false; return;
} }
}); });
return _targetedWallet; return _targetedWallet;
} }
void getDefaultWallet() { WalletData getDefaultWallet(int chest) {
MyWalletsProvider myWalletsProvider = MyWalletsProvider(); if (chestBox.isEmpty) {
return WalletData(chest: 0, number: 0);
if (configBox.get('defaultWallet') == null) { } else {
configBox.put('defaultWallet', [0, 0]); int defaultWalletNumber = chestBox.get(chest).defaultWallet;
return getWalletData([chest, defaultWalletNumber]);
} }
defaultWallet = myWalletsProvider
.getWalletData(configBox.get('defaultWallet').cast<int>());
} }
Future<int> deleteAllWallet(context) async { Future<int> deleteAllWallet(context) async {
@ -94,19 +86,19 @@ class MyWalletsProvider with ChangeNotifier {
barrierDismissible: true, // user must tap button! barrierDismissible: true, // user must tap button!
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: title: const Text(
Text('Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'), 'Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'),
content: SingleChildScrollView(child: Text('')), content: const SingleChildScrollView(child: Text('')),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("Non"), child: const Text("Non"),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
TextButton( TextButton(
key: Key('confirmDeletingAllWallets'), key: const Key('confirmDeletingAllWallets'),
child: Text("Oui"), child: const Text("Oui"),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
@ -120,7 +112,7 @@ class MyWalletsProvider with ChangeNotifier {
Future<void> generateNewDerivation(context, String _name) async { Future<void> generateNewDerivation(context, String _name) async {
int _newDerivationNbr; int _newDerivationNbr;
int _newWalletNbr; int _newWalletNbr;
int _chest = 0; int _chest = getCurrentChest();
List<WalletData> _walletConfig = readAllWallets(_chest); List<WalletData> _walletConfig = readAllWallets(_chest);
if (_walletConfig.isEmpty) { if (_walletConfig.isEmpty) {
@ -135,12 +127,12 @@ class MyWalletsProvider with ChangeNotifier {
chest: _chest, chest: _chest,
number: _newWalletNbr, number: _newWalletNbr,
name: _name, name: _name,
derivation: _newDerivationNbr); derivation: _newDerivationNbr,
imageName: '${_newWalletNbr % 4}.png');
await walletBox.add(newWallet); await walletBox.add(newWallet);
notifyListeners(); notifyListeners();
Navigator.pop(context);
} }
void rebuildWidget() { void rebuildWidget() {

View File

@ -1,6 +1,8 @@
import 'dart:io';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
part 'walletData.g.dart'; part 'wallet_data.g.dart';
@HiveType(typeId: 0) @HiveType(typeId: 0)
class WalletData extends HiveObject { class WalletData extends HiveObject {
@ -16,21 +18,33 @@ class WalletData extends HiveObject {
@HiveField(3) @HiveField(3)
int derivation; int derivation;
WalletData({this.chest, this.number, this.name, this.derivation}); @HiveField(4)
String imageName;
@HiveField(5)
File imageFile;
WalletData(
{this.chest,
this.number,
this.name,
this.derivation,
this.imageName,
this.imageFile});
// representation of WalletData when debugging // representation of WalletData when debugging
@override @override
String toString() { String toString() {
return this.name; return name;
} }
// creates the ':'-separated string from the WalletData // creates the ':'-separated string from the WalletData
String inLine() { String inLine() {
return "${this.chest}:${this.number}:${this.name}:${this.derivation}"; return "$chest:$number:$name:$derivation:$imageName";
} }
// returns only the id part of the ':'-separated string // returns only the id part of the ':'-separated string
List id() { List<int> id() {
return [this.chest, this.number]; return [chest, number];
} }
} }

View File

@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'walletData.dart'; part of 'wallet_data.dart';
// ************************************************************************** // **************************************************************************
// TypeAdapterGenerator // TypeAdapterGenerator
@ -21,13 +21,15 @@ class WalletDataAdapter extends TypeAdapter<WalletData> {
number: fields[1] as int, number: fields[1] as int,
name: fields[2] as String, name: fields[2] as String,
derivation: fields[3] as int, derivation: fields[3] as int,
imageName: fields[4] as String,
imageFile: fields[5] as File,
); );
} }
@override @override
void write(BinaryWriter writer, WalletData obj) { void write(BinaryWriter writer, WalletData obj) {
writer writer
..writeByte(4) ..writeByte(6)
..writeByte(0) ..writeByte(0)
..write(obj.chest) ..write(obj.chest)
..writeByte(1) ..writeByte(1)
@ -35,7 +37,11 @@ class WalletDataAdapter extends TypeAdapter<WalletData> {
..writeByte(2) ..writeByte(2)
..write(obj.name) ..write(obj.name)
..writeByte(3) ..writeByte(3)
..write(obj.derivation); ..write(obj.derivation)
..writeByte(4)
..write(obj.imageName)
..writeByte(5)
..write(obj.imageFile);
} }
@override @override

View File

@ -8,23 +8,23 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:truncate/truncate.dart'; import 'package:truncate/truncate.dart';
import 'package:qrscan/qrscan.dart' as scanner; import 'package:qrscan/qrscan.dart' as scanner;
class WalletOptionsProvider with ChangeNotifier { class WalletOptionsProvider with ChangeNotifier {
TextEditingController pubkey = TextEditingController(); TextEditingController pubkey = TextEditingController();
TextEditingController _newWalletName = TextEditingController(); final TextEditingController _newWalletName = TextEditingController();
bool isWalletUnlock = false; bool isWalletUnlock = false;
bool ischangedPin = false; bool ischangedPin = false;
TextEditingController newPin = new TextEditingController(); TextEditingController newPin = TextEditingController();
bool isEditing = false; bool isEditing = false;
bool isBalanceBlur = true; bool isBalanceBlur = true;
FocusNode walletNameFocus = FocusNode(); FocusNode walletNameFocus = FocusNode();
TextEditingController nameController = TextEditingController(); TextEditingController nameController = TextEditingController();
List<int> walletID;
bool isDefaultWallet; bool isDefaultWallet;
Future<NewWallet> get badWallet => null; Future<NewWallet> get badWallet => null;
@ -32,7 +32,7 @@ class WalletOptionsProvider with ChangeNotifier {
Future _getPubkeyFromDewif( Future _getPubkeyFromDewif(
String _dewif, _pin, int _pinLenght, int derivation) async { String _dewif, _pin, int _pinLenght, int derivation) async {
String _pubkey; String _pubkey;
RegExp regExp = new RegExp( RegExp regExp = RegExp(
r'^[A-Z0-9]+$', r'^[A-Z0-9]+$',
caseSensitive: false, caseSensitive: false,
multiLine: false, multiLine: false,
@ -47,7 +47,7 @@ class WalletOptionsProvider with ChangeNotifier {
List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys( List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys(
dewif: _dewif, secretCode: _pin, accountsIndex: [derivation]); dewif: _dewif, secretCode: _pin, accountsIndex: [derivation]);
_pubkey = _pubkeysTmp[0]; _pubkey = _pubkeysTmp[0];
this.pubkey.text = _pubkey; pubkey.text = _pubkey;
notifyListeners(); notifyListeners();
return _pubkey; return _pubkey;
@ -60,7 +60,7 @@ class WalletOptionsProvider with ChangeNotifier {
} else { } else {
try { try {
_pubkey = await DubpRust.getDewifPublicKey(dewif: _dewif, pin: _pin); _pubkey = await DubpRust.getDewifPublicKey(dewif: _dewif, pin: _pin);
this.pubkey.text = _pubkey; pubkey.text = _pubkey;
notifyListeners(); notifyListeners();
return _pubkey; return _pubkey;
} catch (e) { } catch (e) {
@ -76,13 +76,13 @@ class WalletOptionsProvider with ChangeNotifier {
context, WalletData _wallet, String _pin, int _pinLenght) async { context, WalletData _wallet, String _pin, int _pinLenght) async {
isWalletUnlock = false; isWalletUnlock = false;
try { try {
String _localDewif = chestBox.get(0); String _localDewif = chestBox.get(_wallet.chest).dewif;
String _localPubkey; String _localPubkey;
if ((_localPubkey = await _getPubkeyFromDewif( if ((_localPubkey = await _getPubkeyFromDewif(
_localDewif, _pin, _pinLenght, _wallet.derivation)) != _localDewif, _pin, _pinLenght, _wallet.derivation)) !=
'false') { 'false') {
this.pubkey.text = _localPubkey; pubkey.text = _localPubkey;
isWalletUnlock = true; isWalletUnlock = true;
return _localDewif; return _localDewif;
} else { } else {
@ -91,7 +91,7 @@ class WalletOptionsProvider with ChangeNotifier {
} catch (e) { } catch (e) {
// _homeProvider.playSound('non', 0.6); // _homeProvider.playSound('non', 0.6);
log.e('ERROR READING FILE: $e'); log.e('ERROR READING FILE: $e');
this.pubkey.clear(); pubkey.clear();
return 'bad'; return 'bad';
} }
} }
@ -113,8 +113,8 @@ class WalletOptionsProvider with ChangeNotifier {
int getPinLenght(_walletNbr) { int getPinLenght(_walletNbr) {
String _localDewif; String _localDewif;
if (_walletNbr is int) { if (_walletNbr is int || _walletNbr == null) {
_localDewif = chestBox.get(0); _localDewif = chestBox.get(configBox.get('currentChest')).dewif;
} else { } else {
_localDewif = _walletNbr; _localDewif = _walletNbr;
} }
@ -125,69 +125,33 @@ class WalletOptionsProvider with ChangeNotifier {
return _pinLenght; return _pinLenght;
} }
Future _renameWallet(List<int> _walletID, _newName) async { void _renameWallet(List<int> _walletID, _newName, {bool isCesium}) async {
MyWalletsProvider myWalletClass = MyWalletsProvider(); if (isCesium) {
ChestData _chestTarget = chestBox.get(_walletID[0]);
_chestTarget.name = _newName;
await chestBox.put(_chestTarget.key, _chestTarget);
} else {
MyWalletsProvider myWalletClass = MyWalletsProvider();
WalletData _walletTarget = myWalletClass.getWalletData(_walletID); WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
_walletTarget.name = _newName; _walletTarget.name = _newName;
await walletBox.putAt(_walletTarget.key, _walletTarget); await walletBox.put(_walletTarget.key, _walletTarget);
}
_newWalletName.text = ''; _newWalletName.text = '';
} }
Future<bool> renameWalletAlerte( bool editWalletName(List<int> _wID, {bool isCesium}) {
context, _walletName, _walletNbr, _derivation) async {
return showDialog<bool>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Choisissez un nouveau nom pour ce portefeuille'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
TextField(
controller: this._newWalletName,
maxLines: 1,
textAlign: TextAlign.center,
decoration: InputDecoration(),
style: TextStyle(
fontSize: 14.0,
color: Colors.black,
fontWeight: FontWeight.bold)),
],
),
),
actions: <Widget>[
TextButton(
child: Text("Valider"),
onPressed: () {
WidgetsBinding.instance.addPostFrameCallback((_) async {
// await _renameWallet(_walletName, this._newWalletName.text,
// _walletNbr, _derivation);
});
// notifyListeners();
Navigator.pop(context, true);
},
),
],
);
},
);
}
Future<bool> editWalletName(List<int> _wID) async {
bool nameState; bool nameState;
if (isEditing) { if (isEditing) {
if (!nameController.text.contains(':') && if (!nameController.text.contains(':') &&
nameController.text.length <= 39) { nameController.text.length <= 39) {
await _renameWallet(_wID, nameController.text); _renameWallet(_wID, nameController.text, isCesium: isCesium);
nameState = true; nameState = true;
} else { } else {
nameState = false; nameState = false;
} }
} else { } else {
walletNameFocus.requestFocus();
nameState = true; nameState = true;
} }
@ -220,20 +184,20 @@ class WalletOptionsProvider with ChangeNotifier {
'Êtes-vous sûr de vouloir supprimer le portefeuille "$_walletName" ?'), 'Êtes-vous sûr de vouloir supprimer le portefeuille "$_walletName" ?'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: <Widget>[ children: const <Widget>[
Text('Vous pourrez restaurer ce portefeuille plus tard.'), Text('Vous pourrez restaurer ce portefeuille plus tard.'),
], ],
), ),
), ),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("Non", key: Key('cancelDeleting')), child: const Text("Non", key: Key('cancelDeleting')),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
TextButton( TextButton(
child: Text("Oui", key: Key('confirmDeleting')), child: const Text("Oui", key: Key('confirmDeleting')),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
@ -245,7 +209,7 @@ class WalletOptionsProvider with ChangeNotifier {
} }
snackCopyKey(context) { snackCopyKey(context) {
final snackBar = SnackBar( const snackBar = SnackBar(
content: content:
Text("Cette clé publique a été copié dans votre presse-papier."), Text("Cette clé publique a été copié dans votre presse-papier."),
duration: Duration(seconds: 2)); duration: Duration(seconds: 2));
@ -282,10 +246,11 @@ class WalletOptionsProvider with ChangeNotifier {
File _image; File _image;
final picker = ImagePicker(); final picker = ImagePicker();
final pickedFile = await picker.pickImage(source: ImageSource.gallery); XFile pickedFile = await picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) { if (pickedFile != null) {
_image = File(pickedFile.path); _image = File(pickedFile.path);
log.i(pickedFile.path);
return _image; return _image;
} else { } else {
log.w('No image selected.'); log.w('No image selected.');

View File

@ -5,22 +5,22 @@ import 'package:gecko/globals.dart';
class CommonElements { class CommonElements {
// Exemple de Widget // Exemple de Widget
Widget exemple(String data) { Widget exemple(String data) {
return Text('Coucou'); return const Text('Coucou');
} }
Widget bubbleSpeak(String text, {double long, Key textKey}) { Widget bubbleSpeak(String text, {double long, Key textKey}) {
return Bubble( return Bubble(
padding: long == null padding: long == null
? BubbleEdges.all(18) ? const BubbleEdges.all(18)
: BubbleEdges.symmetric(horizontal: long, vertical: 30), : BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
margin: BubbleEdges.fromLTRB(10, 0, 20, 10), margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop, // nip: BubbleNip.leftTop,
child: Text( child: Text(
text, text,
key: textKey, key: textKey,
style: TextStyle( style: const TextStyle(
color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400), color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400),
), ),
); );
@ -28,15 +28,15 @@ class CommonElements {
Widget bubbleSpeakRich(List<TextSpan> text, {Key textKey}) { Widget bubbleSpeakRich(List<TextSpan> text, {Key textKey}) {
return Bubble( return Bubble(
padding: BubbleEdges.all(18), padding: const BubbleEdges.all(18),
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
margin: BubbleEdges.fromLTRB(10, 0, 20, 10), margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop, // nip: BubbleNip.leftTop,
child: RichText( child: RichText(
key: textKey, key: textKey,
text: TextSpan( text: TextSpan(
style: TextStyle( style: const TextStyle(
fontSize: 18.0, fontSize: 18.0,
color: Colors.black, color: Colors.black,
), ),
@ -87,7 +87,7 @@ class CommonElements {
top: 70, top: 70,
right: 90, right: 90,
child: Text(progress == 12 ? '11/11' : '$progress/11', child: Text(progress == 12 ? '11/11' : '$progress/11',
style: TextStyle(fontSize: 12, color: Colors.black)), style: const TextStyle(fontSize: 12, color: Colors.black)),
), ),
]); ]);
} }
@ -102,7 +102,7 @@ class CommonElements {
return Container( return Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: Padding(
@ -113,7 +113,7 @@ class CommonElements {
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -207,14 +207,15 @@ class GeckoSpeechAppBar extends StatelessWidget with PreferredSizeWidget {
GeckoSpeechAppBar( GeckoSpeechAppBar(
this.title, { this.title, {
Key key, Key key,
}) : preferredSize = Size.fromHeight(105.4), }) : preferredSize = const Size.fromHeight(105.4),
super(key: key); super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( return AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton( leading: IconButton(
icon: Container( icon: SizedBox(
height: 30, height: 30,
child: Image.asset('assets/onBoarding/gecko_bar.png')), child: Image.asset('assets/onBoarding/gecko_bar.png')),
onPressed: () => Navigator.popUntil( onPressed: () => Navigator.popUntil(

View File

@ -1,13 +1,15 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/cesiumPlus.dart'; import 'package:gecko/models/cesium_plus.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart'; import 'package:gecko/models/queries.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:gecko/screens/myWallets/unlockingWallet.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'dart:ui'; import 'dart:ui';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -20,7 +22,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
final nRepositories = 20; final nRepositories = 20;
// HistoryProvider _historyProvider; // HistoryProvider _historyProvider;
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
FocusNode _pubkeyFocus = FocusNode(); final FocusNode _pubkeyFocus = FocusNode();
List cesiumData; List cesiumData;
final double avatarsSize = 80; final double avatarsSize = 80;
@ -28,22 +30,25 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
FetchMoreOptions opts; FetchMoreOptions opts;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
HistoryScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context); HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
HomeProvider _homeProvider = Provider.of<HomeProvider>(context); HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
this._outputPubkey.text = _historyProvider.pubkey; _outputPubkey.text = _historyProvider.pubkey;
log.i('Build pubkey : ' + _historyProvider.pubkey); log.i('Build pubkey : ' + _historyProvider.pubkey);
WidgetsBinding.instance.addPostFrameCallback((_) {}); WidgetsBinding.instance.addPostFrameCallback((_) {});
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio,
title: _homeProvider.appBarExplorer, title: _homeProvider.appBarExplorer,
actions: [ actions: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: IconButton( child: IconButton(
icon: _homeProvider.searchIcon, icon: _homeProvider.searchIcon,
color: Colors.grey[850], color: Colors.grey[850],
@ -79,9 +84,9 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
} }
})) }))
], ],
backgroundColor: Color(0xffFFD58D), backgroundColor: const Color(0xffFFD58D),
), ),
floatingActionButton: Container( floatingActionButton: SizedBox(
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
child: FittedBox( child: FittedBox(
@ -90,11 +95,11 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
onPressed: () async { onPressed: () async {
await _historyProvider.scan(context); await _historyProvider.scan(context);
}, },
child: Container( child: SizedBox(
height: 40.0, height: 40.0,
width: 40.0, width: 40.0,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 3), padding: const EdgeInsets.symmetric(horizontal: 3),
child: Image.asset('assets/qrcode-scan.png'))), child: Image.asset('assets/qrcode-scan.png'))),
backgroundColor: backgroundColor:
floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255), floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255),
@ -102,7 +107,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
), ),
), ),
body: Column(children: <Widget>[ body: Column(children: <Widget>[
SizedBox(height: 0), const SizedBox(height: 0),
if (_historyProvider.pubkey != '') if (_historyProvider.pubkey != '')
historyQuery(context, _historyProvider), historyQuery(context, _historyProvider),
])); ]));
@ -137,7 +142,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
if (result.hasException) { if (result.hasException) {
log.e('Error GVA: ' + result.exception.toString()); log.e('Error GVA: ' + result.exception.toString());
return Column(children: <Widget>[ return Column(children: const <Widget>[
SizedBox(height: 50), SizedBox(height: 50),
Text( Text(
"Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.", "Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.",
@ -169,10 +174,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: Builder( child: Builder(
builder: (context) => Expanded( builder: (context) => Expanded(
child: ListView( child: ListView(
key: Key('listTransactions'), key: const Key('listTransactions'),
controller: scrollController, controller: scrollController,
children: <Widget>[ children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
if (_historyProvider.pubkey != '') if (_historyProvider.pubkey != '')
Row( Row(
mainAxisAlignment: mainAxisAlignment:
@ -212,7 +217,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
if (_avatar.hasData) { if (_avatar.hasData) {
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.all(0.0), const EdgeInsets.all(
0.0),
child: Image.file( child: Image.file(
_avatar.data[0], _avatar.data[0],
height: avatarsSize)); height: avatarsSize));
@ -223,7 +229,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
height: avatarsSize); height: avatarsSize);
})), })),
GestureDetector( GestureDetector(
key: Key('copyPubkey'), key: const Key('copyPubkey'),
onTap: () { onTap: () {
Clipboard.setData(ClipboardData( Clipboard.setData(ClipboardData(
text: _historyProvider.pubkey)); text: _historyProvider.pubkey));
@ -232,7 +238,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: Text( child: Text(
_historyProvider.getShortPubkey( _historyProvider.getShortPubkey(
_historyProvider.pubkey), _historyProvider.pubkey),
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace')), fontFamily: 'Monospace')),
@ -255,7 +261,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
], ],
), ),
)), )),
SizedBox(width: 0) const SizedBox(width: 0)
]), ]),
if (_isFirstExec) if (_isFirstExec)
Row( Row(
@ -272,25 +278,22 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
_historyProvider.pubkey), _historyProvider.pubkey),
initialData: '...', initialData: '...',
builder: (context, snapshot) { builder: (context, snapshot) {
return Text( return Text(snapshot.data ?? '-',
snapshot.data != null style: const TextStyle(
? snapshot.data fontSize: 20));
: '-',
style:
TextStyle(fontSize: 20));
})) }))
]), ]),
SizedBox(height: 18), const SizedBox(height: 18),
if (_isFirstExec) if (_isFirstExec)
Container( Container(
padding: padding:
const EdgeInsets.fromLTRB(0, 0, 0, 0), const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Text(balance.toString() + ' Ğ1', child: Text(balance.toString() + ' Ğ1',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 18.0))), style: const TextStyle(fontSize: 18.0))),
SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
key: Key('switchPayHistory'), key: const Key('switchPayHistory'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 1, elevation: 1,
primary: Colors.grey[50], // background primary: Colors.grey[50], // background
@ -330,6 +333,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
} }
Widget payView(context, HistoryProvider _historyProvider) { Widget payView(context, HistoryProvider _historyProvider) {
MyWalletsProvider _myWalletProvider = MyWalletsProvider();
WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
return Stack( return Stack(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
children: <Widget>[ children: <Widget>[
@ -338,32 +345,32 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
Text('Commentaire:', style: TextStyle(fontSize: 20.0)), const Text('Commentaire:', style: TextStyle(fontSize: 20.0)),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextField( child: TextField(
controller: _historyProvider.payComment, controller: _historyProvider.payComment,
maxLines: 2, maxLines: 2,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold))), fontWeight: FontWeight.bold))),
SizedBox(height: 20), const SizedBox(height: 20),
Text('Montant (DU/Ğ1):', style: TextStyle(fontSize: 20.0)), const Text('Montant (DU/Ğ1):', style: TextStyle(fontSize: 20.0)),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 22), style: const TextStyle(fontSize: 22),
controller: _historyProvider.payAmount, controller: _historyProvider.payAmount,
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 1, maxLines: 1,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: contentPadding: const EdgeInsets.symmetric(
EdgeInsets.symmetric(vertical: 25.0, horizontal: 10.0), vertical: 25.0, horizontal: 10.0),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0)), borderRadius: BorderRadius.circular(10.0)),
), ),
@ -406,7 +413,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
int keyID = 0; int keyID = 0;
return _historyProvider.transBC == null return _historyProvider.transBC == null
? Text('Aucune transaction à afficher.') ? const Text('Aucune transaction à afficher.')
: Column(children: <Widget>[ : Column(children: <Widget>[
for (var repository in _historyProvider.transBC) for (var repository in _historyProvider.transBC)
Padding( Padding(
@ -421,14 +428,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
textAlign: TextAlign.center), textAlign: TextAlign.center),
title: Text(repository[3], title: Text(repository[3],
style: TextStyle( style: const TextStyle(
fontSize: 15.0, fontFamily: 'Monospace'), fontSize: 15.0, fontFamily: 'Monospace'),
textAlign: TextAlign.center), textAlign: TextAlign.center),
subtitle: Text(repository[6] != '' ? repository[6] : '-', subtitle: Text(repository[6] != '' ? repository[6] : '-',
style: TextStyle(fontSize: 12.0), style: const TextStyle(fontSize: 12.0),
textAlign: TextAlign.center), textAlign: TextAlign.center),
trailing: Text("${repository[4]} Ğ1", trailing: Text("${repository[4]} Ğ1",
style: TextStyle(fontSize: 14.0), style: const TextStyle(fontSize: 14.0),
textAlign: TextAlign.justify), textAlign: TextAlign.justify),
dense: true, dense: true,
isThreeLine: false, isThreeLine: false,
@ -439,14 +446,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
if (result.isLoading) if (result.isLoading)
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: const <Widget>[
CircularProgressIndicator(), CircularProgressIndicator(),
], ],
), ),
// if (_historyProvider.isTheEnd) // What I did before ... // if (_historyProvider.isTheEnd) // What I did before ...
if (!_historyProvider.pageInfo['hasPreviousPage']) if (!_historyProvider.pageInfo['hasPreviousPage'])
Column( Column(
children: <Widget>[ children: const <Widget>[
SizedBox(height: 15), SizedBox(height: 15),
Text("Début de l'historique.", Text("Début de l'historique.",
textAlign: TextAlign.center, textAlign: TextAlign.center,

View File

@ -1,17 +1,21 @@
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_provider.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/screens/myWallets/unlockingWallet.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/onBoarding/0_no_keychain_found.dart';
import 'dart:ui'; import 'dart:ui';
import 'package:gecko/screens/settings.dart'; import 'package:gecko/screens/settings.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class HomeScreen extends StatelessWidget { class HomeScreen extends StatelessWidget {
const HomeScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -20,6 +24,8 @@ class HomeScreen extends StatelessWidget {
HistoryProvider _historyStatic = HistoryProvider(''); HistoryProvider _historyStatic = HistoryProvider('');
MyWalletsProvider _myWalletProvider = MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context); Provider.of<MyWalletsProvider>(context);
Provider.of<ChestProvider>(context);
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist(); final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
// walletBox.toMap().forEach((key, value) { // walletBox.toMap().forEach((key, value) {
@ -35,319 +41,321 @@ class HomeScreen extends StatelessWidget {
ratio = 1.125; ratio = 1.125;
} }
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
drawer: Drawer( drawer: Drawer(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: ListView(padding: EdgeInsets.zero, children: <Widget>[ child: ListView(padding: EdgeInsets.zero, children: <Widget>[
DrawerHeader( DrawerHeader(
child: Column(children: <Widget>[ child: Column(children: const <Widget>[
SizedBox(height: 0), SizedBox(height: 0),
Image(
image: AssetImage('assets/icon/gecko_final.png'),
height: 130),
]),
decoration: BoxDecoration(
color: orangeC,
),
),
ListTile(
key: const Key('parameters'),
title: const Text('Paramètres'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SettingsScreen();
}),
);
},
),
ListTile(
title: const Text('A propos'),
onTap: () {
// Update the state of the app.
// ...
},
),
])),
Align(
alignment: FractionalOffset.bottomCenter,
child: Text('Ğecko v$appVersion')),
const SizedBox(height: 20)
],
),
),
appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: Builder(
builder: (context) => IconButton(
key: const Key('drawerMenu'),
icon: Icon(Icons.menu, color: Colors.grey[850]),
onPressed: () => Scaffold.of(context).openDrawer(),
)),
title: _homeProvider.appBarTitle,
actions: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: IconButton(
key: const Key('searchIcon'),
icon: _homeProvider.searchIcon,
color: Colors.grey[850],
onPressed: () {
if (_homeProvider.searchIcon.icon == Icons.search) {
_homeProvider.searchIcon = Icon(
Icons.close,
color: Colors.grey[850],
);
_homeProvider.appBarTitle = TextField(
key: const Key('searchInput'),
autofocus: true,
controller: _homeProvider.searchQuery,
onChanged: (text) {
log.d("Clé tappé: $text");
final String searchResult =
_historyProvider.isPubkey(context, text);
if (searchResult != '') {
_homeProvider.currentIndex = 0;
}
},
style: TextStyle(
color: Colors.grey[850],
),
decoration: InputDecoration(
prefixIcon:
Icon(Icons.search, color: Colors.grey[850]),
hintText: "Rechercher ...",
hintStyle: TextStyle(color: Colors.grey[850])),
);
_homeProvider.handleSearchStart();
} else {
_homeProvider.handleSearchEnd();
}
}))
],
backgroundColor: const Color(0xffFFD58D),
),
backgroundColor: const Color(0xffF9F9F1),
body: Builder(
builder: (ctx) => StatefulWrapper(
onInit: () {
WidgetsBinding.instance.addPostFrameCallback((_) {
DubpRust.setup();
_historyStatic.snackNode(ctx);
});
},
child: Column(children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
SizedBox(width: 7),
Image( Image(
image: AssetImage('assets/icon/gecko_final.png'), image: AssetImage('assets/icon/gecko_final.png'),
height: 130), height: 180),
]), ]),
decoration: BoxDecoration( ),
color: orangeC,
),
),
ListTile(
key: Key('parameters'),
title: Text('Paramètres'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SettingsScreen();
}),
);
},
),
ListTile(
title: Text('A propos'),
onTap: () {
// Update the state of the app.
// ...
},
),
])),
Container(
child: Align(
alignment: FractionalOffset.bottomCenter,
child: Text('Ğecko v$appVersion'))),
SizedBox(height: 20)
],
),
),
appBar: AppBar(
leading: Builder(
builder: (context) => IconButton(
key: Key('drawerMenu'),
icon: new Icon(Icons.menu, color: Colors.grey[850]),
onPressed: () => Scaffold.of(context).openDrawer(),
)),
title: _homeProvider.appBarTitle,
actions: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.only(top: 15),
child: IconButton( child: Row(
key: Key('searchIcon'), mainAxisAlignment: MainAxisAlignment.center,
icon: _homeProvider.searchIcon, children: const <Widget>[
color: Colors.grey[850], Text(
onPressed: () { "y'a pas de lézard !",
if (_homeProvider.searchIcon.icon == Icons.search) { textAlign: TextAlign.center,
_homeProvider.searchIcon = Icon( style: TextStyle(
Icons.close, color: Colors.black,
color: Colors.grey[850], fontSize: 17,
); fontStyle: FontStyle.italic),
_homeProvider.appBarTitle = TextField( )
key: Key('searchInput'),
autofocus: true,
controller: _homeProvider.searchQuery,
onChanged: (text) {
log.d("Clé tappé: $text");
final String searchResult =
_historyProvider.isPubkey(context, text);
if (searchResult != '') {
_homeProvider.currentIndex = 0;
}
},
style: TextStyle(
color: Colors.grey[850],
),
decoration: InputDecoration(
prefixIcon:
Icon(Icons.search, color: Colors.grey[850]),
hintText: "Rechercher ...",
hintStyle: TextStyle(color: Colors.grey[850])),
);
_homeProvider.handleSearchStart();
} else {
_homeProvider.handleSearchEnd();
}
}))
],
backgroundColor: Color(0xffFFD58D),
),
backgroundColor: Color(0xffF9F9F1),
body: Builder(
builder: (ctx) => StatefulWrapper(
onInit: () {
WidgetsBinding.instance.addPostFrameCallback((_) {
DubpRust.setup();
_historyStatic.snackNode(ctx);
});
},
child: Column(children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(width: 7),
Image(
image:
AssetImage('assets/icon/gecko_final.png'),
height: 180),
])),
Padding(
padding: EdgeInsets.only(top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"y'a pas de lézard !",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontSize: 17,
fontStyle: FontStyle.italic),
)
])),
Padding(
padding: EdgeInsets.only(top: 60),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(children: <Widget>[
Container(
child: ClipOval(
child: Material(
color: Color(0xffFFD58D), // button color
child: InkWell(
splashColor: orangeC, // inkwell color
child: Padding(
padding: EdgeInsets.all(22),
child: Image(
image: AssetImage(
'assets/qrcode-scan.png'),
height: 60)),
onTap: () async {
await _historyProvider
.scan(context);
}),
),
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(2.0, 2.5),
spreadRadius: 0.5)
],
),
),
SizedBox(height: 12),
Text(
"Payer par QR-Code",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontSize: 16),
)
])
])),
Padding(
padding: EdgeInsets.only(top: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(children: <Widget>[
Container(
child: ClipOval(
child: Material(
color: Color(0xffFFD58D), // button color
child: InkWell(
splashColor: orangeC, // inkwell color
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 20, vertical: 16),
child: Image(
image: AssetImage(
'assets/blockchain.png'),
height: 70)),
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) {
// return TemplateScreen();
// }),
// );
}),
),
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(2.0, 2.5),
spreadRadius: 0.5)
],
),
),
SizedBox(height: 12),
Text(
"Explorer\n",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontSize: 16),
)
]),
SizedBox(width: 140),
Column(children: <Widget>[
Container(
child: ClipOval(
key: Key('manageWallets'),
child: Material(
color: Color(0xffFFD58D), // button color
child: InkWell(
splashColor: orangeC, // inkwell color
child: Padding(
padding: EdgeInsets.all(23),
child: Image(
image: AssetImage(
'assets/lock.png'),
height: 57)),
onTap: () {
isWalletsExists
? Navigator.push(context,
MaterialPageRoute(
builder: (context) {
return UnlockingWallet(
wallet: defaultWallet,
action: "mywallets",
);
}))
// Navigator.pushNamed(
// context, '/mywallets')
: Navigator.push(context,
MaterialPageRoute(
builder: (context) {
return NoKeyChainScreen();
}));
}),
),
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(2.0, 2.5),
spreadRadius: 0.5)
],
),
),
SizedBox(height: 12),
Text(
"Gérer mes\nportefeuilles",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black, fontSize: 16),
)
])
]))
]), ]),
// bottomNavigationBar: BottomNavigationBar( ),
// backgroundColor: Color(0xffFFD58D), Padding(
// fixedColor: Colors.grey[850], padding: EdgeInsets.only(top: isTall ? 100 : 60),
// unselectedItemColor: Color(0xffBD935C), child: Row(
// type: BottomNavigationBarType.fixed, mainAxisAlignment: MainAxisAlignment.center,
// onTap: (index) { children: <Widget>[
// _homeProvider.currentIndex = index; Column(children: <Widget>[
// }, Container(
// currentIndex: _homeProvider.currentIndex, child: ClipOval(
// items: [ child: Material(
// BottomNavigationBarItem( color: const Color(0xffFFD58D), // button color
// icon: Image.asset('assets/block-space-disabled.png', height: 26), child: InkWell(
// activeIcon: Image.asset('assets/blockchain.png', height: 26), splashColor: orangeC, // inkwell color
// label: 'Explorateur', child: const Padding(
// ), padding: EdgeInsets.all(22),
// BottomNavigationBarItem( child: Image(
// icon: Icon(Icons.lock), image: AssetImage(
// label: 'Mes portefeuilles', 'assets/qrcode-scan.png'),
// ), height: 60)),
// ], onTap: () async {
// ), await _historyProvider.scan(context);
))); }),
),
),
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(2.0, 2.5),
spreadRadius: 0.5)
],
),
),
const SizedBox(height: 12),
const Text(
"Payer par QR-Code",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 16),
)
])
]),
),
Padding(
padding: const EdgeInsets.only(top: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(children: <Widget>[
Container(
child: ClipOval(
child: Material(
color: const Color(0xffFFD58D), // button color
child: InkWell(
splashColor: orangeC, // inkwell color
child: const Padding(
padding: EdgeInsets.symmetric(
horizontal: 20, vertical: 16),
child: Image(
image:
AssetImage('assets/blockchain.png'),
height: 70)),
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) {
// return TemplateScreen();
// }),
// );
}),
),
),
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(2.0, 2.5),
spreadRadius: 0.5)
],
),
),
const SizedBox(height: 12),
const Text(
"Explorer\n",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 16),
)
]),
const SizedBox(width: 140),
Column(children: <Widget>[
Container(
child: ClipOval(
key: const Key('manageWallets'),
child: Material(
color: const Color(0xffFFD58D), // button color
child: InkWell(
splashColor: orangeC, // inkwell color
child: const Padding(
padding: EdgeInsets.all(23),
child: Image(
image: AssetImage('assets/lock.png'),
height: 57)),
onTap: () {
WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(
configBox.get('currentChest'));
isWalletsExists
? Navigator.push(context,
MaterialPageRoute(builder: (context) {
return UnlockingWallet(
wallet: defaultWallet,
action: "mywallets",
);
}))
// Navigator.pushNamed(
// context, '/mywallets')
: Navigator.push(context,
MaterialPageRoute(builder: (context) {
return const NoKeyChainScreen();
}));
}),
),
),
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(2.0, 2.5),
spreadRadius: 0.5)
],
),
),
const SizedBox(height: 12),
const Text(
"Gérer mes\nportefeuilles",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 16),
)
])
]),
)
]),
// bottomNavigationBar: BottomNavigationBar(
// backgroundColor: Color(0xffFFD58D),
// fixedColor: Colors.grey[850],
// unselectedItemColor: Color(0xffBD935C),
// type: BottomNavigationBarType.fixed,
// onTap: (index) {
// _homeProvider.currentIndex = index;
// },
// currentIndex: _homeProvider.currentIndex,
// items: [
// BottomNavigationBarItem(
// icon: Image.asset('assets/block-space-disabled.png', height: 26),
// activeIcon: Image.asset('assets/blockchain.png', height: 26),
// label: 'Explorateur',
// ),
// BottomNavigationBarItem(
// icon: Icon(Icons.lock),
// label: 'Mes portefeuilles',
// ),
// ],
// ),
),
),
);
} }
} }
class StatefulWrapper extends StatefulWidget { class StatefulWrapper extends StatefulWidget {
final Function onInit; final Function onInit;
final Widget child; final Widget child;
const StatefulWrapper({@required this.onInit, @required this.child}); const StatefulWrapper({Key key, @required this.onInit, @required this.child})
: super(key: key);
@override @override
_StatefulWrapperState createState() => _StatefulWrapperState(); _StatefulWrapperState createState() => _StatefulWrapperState();
} }

View File

@ -0,0 +1,352 @@
import 'dart:io';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/chest_provider.dart';
import 'package:gecko/models/history.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/models/wallet_options.dart';
import 'package:gecko/screens/myWallets/change_pin.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
int _nbrLinesName = 1;
bool _isNewNameValid = false;
Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
MyWalletsProvider _myWalletProvider) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context);
ChestProvider _chestProvider =
Provider.of<ChestProvider>(context, listen: false);
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
final String shortPubkey =
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
if (_walletOptions.nameController.text == null || _isNewNameValid == false) {
_walletOptions.nameController.text = cesiumWallet.name;
} else {
cesiumWallet.name = _walletOptions.nameController.text;
}
_walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2
: _nbrLinesName = 1;
if (_walletOptions.nameController.text.length >= 26 && isTall) {
_nbrLinesName = 3;
}
return Scaffold(
resizeToAvoidBottomInset: false,
body: Builder(
builder: (ctx) => SafeArea(
child: Column(children: <Widget>[
Container(
height: isTall ? 30 : 15,
color: yellowC,
),
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
yellowC,
const Color(0xfffafafa),
],
)),
child: Row(children: <Widget>[
const SizedBox(width: 25),
InkWell(
onTap: () async {
File newAvatar = await _walletOptions.changeAvatar();
if (newAvatar != null) {
cesiumWallet.imageFile = newAvatar;
}
_walletOptions.reloadBuild();
},
child: cesiumWallet.imageFile == null
? Image.asset(
'assets/chests/${cesiumWallet.imageName}',
width: 110,
)
: Image.file(cesiumWallet.imageFile, width: 110),
),
InkWell(
onTap: () async {
File newAvatar = await _walletOptions.changeAvatar();
if (newAvatar != null) {
cesiumWallet.imageFile = newAvatar;
}
_walletOptions.reloadBuild();
},
child: Column(children: <Widget>[
Image.asset(
'assets/walletOptions/camera.png',
),
const SizedBox(height: 100)
])),
Column(children: <Widget>[
Row(children: <Widget>[
Column(children: <Widget>[
SizedBox(
width: 260,
child: TextField(
key: const Key('walletName'),
autofocus: false,
focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController,
maxLines: _nbrLinesName,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.all(15.0),
),
style: TextStyle(
fontSize: isTall ? 27 : 23,
color: Colors.black,
fontWeight: FontWeight.w400,
fontFamily: 'Monospace')),
),
SizedBox(height: isTall ? 5 : 0),
Query(
options: QueryOptions(
document: gql(getBalance),
variables: {
'pubkey': _walletOptions.pubkey.text,
},
// pollInterval: Duration(seconds: 1),
),
builder: (QueryResult result,
{VoidCallback refetch, FetchMore fetchMore}) {
if (result.hasException) {
return Text(result.exception.toString());
}
if (result.isLoading) {
return const Text('Loading');
}
// List repositories = result.data['viewer']['repositories']['nodes'];
String wBalanceUD;
if (result.data['balance'] == null) {
wBalanceUD = '0.0';
} else {
int wBalanceG1 = result.data['balance']['amount'];
int currentUD = result.data['currentUd']['amount'];
double wBalanceUDBrut =
wBalanceG1 / currentUD; // .toString();
wBalanceUD = double.parse(
(wBalanceUDBrut).toStringAsFixed(2))
.toString();
}
return Row(children: <Widget>[
ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX: _walletOptions.isBalanceBlur ? 6 : 0,
sigmaY: _walletOptions.isBalanceBlur ? 5 : 0),
child: Text(wBalanceUD,
style: TextStyle(
fontSize: isTall ? 20 : 18,
color: Colors.black)),
),
Text(' DU',
style: TextStyle(
fontSize: isTall ? 20 : 18,
color: Colors.black))
]);
// Text(
// '$wBalanceUD DU',
// style: TextStyle(
// fontSize: 20, color: Colors.black),
// );
},
),
const SizedBox(height: 5),
InkWell(
key: const Key('displayBalance'),
onTap: () {
_walletOptions.bluringBalance();
},
child: Image.asset(
_walletOptions.isBalanceBlur
? 'assets/walletOptions/icon_oeuil.png'
: 'assets/walletOptions/icon_oeuil_close.png',
)),
]),
const SizedBox(width: 0),
Column(children: <Widget>[
InkWell(
key: const Key('renameWallet'),
onTap: () async {
_isNewNameValid = _walletOptions.editWalletName(
[cesiumWallet.key, 0],
isCesium: cesiumWallet.isCesium);
await Future.delayed(
const Duration(milliseconds: 30));
_walletOptions.walletNameFocus.requestFocus();
},
child: ClipRRect(
child: Image.asset(
_walletOptions.isEditing
? 'assets/walletOptions/android-checkmark.png'
: 'assets/walletOptions/edit.png',
width: 20,
height: 20),
)),
const SizedBox(
height: 60,
)
])
]),
]),
])),
SizedBox(height: 4 * ratio),
FutureBuilder(
future: _walletOptions.generateQRcode(_walletOptions.pubkey.text),
builder: (context, snapshot) {
return snapshot.data != null
? Image.memory(snapshot.data, height: isTall ? 300 : 270)
: const Text('-', style: TextStyle(fontSize: 20));
}),
SizedBox(height: 15 * ratio),
GestureDetector(
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(
ClipboardData(text: _walletOptions.pubkey.text));
_walletOptions.snackCopyKey(ctx);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/key.png',
),
const SizedBox(width: 20),
Text("${shortPubkey.split(':')[0]}:",
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w800,
fontFamily: 'Monospace',
color: Colors.black)),
Text(shortPubkey.split(':')[1],
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w800,
fontFamily: 'Monospace')),
const SizedBox(width: 15),
SizedBox(
height: 40,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 1,
primary: orangeC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
Clipboard.setData(ClipboardData(
text: _walletOptions.pubkey.text));
_walletOptions.snackCopyKey(ctx);
},
child: Row(children: <Widget>[
Image.asset(
'assets/walletOptions/copy-white.png',
),
const SizedBox(width: 7),
Text('Copier',
style: TextStyle(
fontSize: 15, color: Colors.grey[50]))
]))),
]))),
SizedBox(height: 10 * ratio),
InkWell(
key: const Key('displayHistory'),
onTap: () {
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
goHistory: true);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/clock.png',
),
const SizedBox(width: 22),
const Text('Historique des transactions',
style: TextStyle(fontSize: 20, color: Colors.black)),
]))),
SizedBox(height: 7 * ratio),
InkWell(
key: const Key('changePin'),
onTap: () async {
// await _chestProvider.changePin(context, cesiumWallet);
_myWalletProvider.pinCode = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return ChangePinScreen(
walletName: cesiumWallet.name,
walletProvider: _myWalletProvider,
);
},
),
);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 28),
Image.asset(
'assets/chests/secret_code.png',
),
const SizedBox(width: 18),
const Text('Changer mon code secret',
style: TextStyle(fontSize: 20, color: Colors.black)),
])),
),
SizedBox(height: 7 * ratio),
InkWell(
key: const Key('deleteWallet'),
onTap: () async {
await _chestProvider.deleteChest(context, cesiumWallet);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 33),
Image.asset(
'assets/walletOptions/trash.png',
),
const SizedBox(width: 25),
const Text(
'Supprimer ce coffre',
style: TextStyle(
fontSize: 20,
color: Color(0xffD80000),
),
),
]),
),
),
]),
),
),
);
}

View File

@ -1,103 +0,0 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/changePin.dart';
import 'dart:io';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class ChangePinScreen extends StatelessWidget with ChangeNotifier {
ChangePinScreen(
{Key keyMyWallets, @required this.walletName, @required this.oldPin})
: super(key: keyMyWallets);
final String walletName;
final oldPin;
Directory appPath;
NewWallet _newWalletFile;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
ChangePinProvider _changePin = Provider.of<ChangePinProvider>(context);
// _walletOptions.changePin(walletName, oldPin);
// _walletOptions.newPin.text = _tmpPin;
return WillPopScope(
onWillPop: () {
_changePin.newPin.text = '';
return Future<bool>.value(true);
},
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
_changePin.newPin.text = '';
Navigator.of(context).pop();
}),
title: SizedBox(
height: 22,
child: Text(walletName),
)),
body: Center(
child: SafeArea(
child: Column(children: <Widget>[
SizedBox(height: 80),
Text(
'Choisissez un code secret autogénéré :',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.0,
color: Colors.grey[600],
fontWeight: FontWeight.w400),
),
SizedBox(height: 30),
Container(
child: Stack(
alignment: Alignment.centerRight,
children: <Widget>[
TextField(
enabled: true,
controller: _changePin.newPin,
maxLines: 1,
textAlign: TextAlign.center,
decoration: InputDecoration(),
style: TextStyle(
fontSize: 30.0,
color: Colors.black,
fontWeight: FontWeight.bold)),
IconButton(
icon: Icon(Icons.replay),
color: orangeC,
onPressed: () async {
_newWalletFile =
await _changePin.changePin(walletName, oldPin);
},
),
],
),
),
SizedBox(height: 30),
SizedBox(
width: 200,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 12,
primary: Colors.green[400], //smoothYellow, // background
onPrimary: Colors.black, // foreground
),
onPressed: _changePin.newPin.text != ''
? () {
_changePin.newPin.text = '';
_changePin.storeWallet(
context, walletName, _newWalletFile);
}
: null,
child: Text('Confirmer', style: TextStyle(fontSize: 28))),
)
])))));
}
}

View File

@ -0,0 +1,113 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/change_pin.dart';
import 'package:gecko/models/my_wallets.dart';
import 'dart:io';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class ChangePinScreen extends StatelessWidget with ChangeNotifier {
ChangePinScreen(
{Key keyMyWallets,
@required this.walletName,
@required this.walletProvider})
: super(key: keyMyWallets);
final String walletName;
final MyWalletsProvider walletProvider;
Directory appPath;
NewWallet _newWalletFile;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
ChangePinProvider _changePin = Provider.of<ChangePinProvider>(context);
// _walletOptions.changePin(walletName, oldPin);
// _walletOptions.newPin.text = _tmpPin;
return WillPopScope(
onWillPop: () {
_changePin.newPin.text = '';
return Future<bool>.value(true);
},
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
_changePin.newPin.text = '';
Navigator.of(context).pop();
}),
title: SizedBox(
height: 22,
child: Text(walletName),
)),
body: Center(
child: SafeArea(
child: Column(children: <Widget>[
const SizedBox(height: 80),
Text(
'Choisissez un code secret autogénéré :',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.0,
color: Colors.grey[600],
fontWeight: FontWeight.w400),
),
const SizedBox(height: 30),
Stack(
alignment: Alignment.centerRight,
children: <Widget>[
TextField(
enabled: false,
controller: _changePin.newPin,
maxLines: 1,
textAlign: TextAlign.center,
decoration: const InputDecoration(),
style: const TextStyle(
fontSize: 30.0,
color: Colors.black,
fontWeight: FontWeight.bold)),
IconButton(
icon: const Icon(Icons.replay),
color: orangeC,
onPressed: () async {
_newWalletFile =
await _changePin.changePin(walletProvider.pinCode);
},
),
],
),
const SizedBox(height: 30),
SizedBox(
width: 200,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 12,
primary: Colors.green[400], //smoothYellow, // background
onPrimary: Colors.black, // foreground
),
onPressed: _changePin.newPin.text != ''
? () {
_changePin.newPin.text = '';
_changePin.storeNewPinChest(context, _newWalletFile);
walletProvider.pinCode = _changePin.newPin.text;
}
: null,
child: const Text(
'Confirmer',
style: TextStyle(fontSize: 28),
),
),
)
]),
),
),
),
);
}
}

View File

@ -0,0 +1,102 @@
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:flutter/services.dart';
import 'package:gecko/models/chest_provider.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/screens/myWallets/change_pin.dart';
import 'package:provider/provider.dart';
class ChestOptions extends StatelessWidget {
const ChestOptions({Key keyMyWallets, @required this.walletProvider})
: super(key: keyMyWallets);
final MyWalletsProvider walletProvider;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
ChestProvider _chestProvider =
Provider.of<ChestProvider>(context, listen: false);
ChestData currentChest = chestBox.get(configBox.get('currentChest'));
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
Navigator.popUntil(
context,
ModalRoute.withName('/mywallets'),
);
}),
title: SizedBox(
height: 22,
child: Text(currentChest.name),
)),
body: Builder(
builder: (ctx) => SafeArea(
child: Column(children: <Widget>[
SizedBox(height: 30 * ratio),
InkWell(
key: const Key('changePin'),
onTap: () async {
// await _chestProvider.changePin(context, cesiumWallet);
walletProvider.pinCode = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return ChangePinScreen(
walletName: currentChest.name,
walletProvider: walletProvider,
);
},
),
);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 28),
Image.asset(
'assets/chests/secret_code.png',
),
const SizedBox(width: 18),
const Text('Changer mon code secret',
style: TextStyle(fontSize: 20, color: Colors.black)),
])),
),
SizedBox(height: 10 * ratio),
InkWell(
key: const Key('deleteChest'),
onTap: () async {
await _chestProvider.deleteChest(context, currentChest);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 33),
Image.asset(
'assets/walletOptions/trash.png',
),
const SizedBox(width: 24),
const Text(
'Supprimer ce coffre',
style: TextStyle(
fontSize: 20,
color: Color(0xffD80000),
),
),
]),
),
),
]),
),
),
);
}
}

View File

@ -0,0 +1,158 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/generate_wallets.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:provider/provider.dart';
class ChooseChest extends StatefulWidget {
const ChooseChest({Key key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return _ChooseChestState();
}
}
// ignore: must_be_immutable
class _ChooseChestState extends State<ChooseChest> {
TextEditingController tplController = TextEditingController();
CarouselController buttonCarouselController = CarouselController();
int currentChest = configBox.get('currentChest');
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
return Scaffold(
appBar: AppBar(
toolbarHeight: 60 * ratio,
title: const SizedBox(
height: 22,
child: Text('Sélectionner mon coffre'),
)),
body: SafeArea(
child: Column(children: <Widget>[
SizedBox(height: 160 * ratio),
CarouselSlider(
carouselController: buttonCarouselController,
options: CarouselOptions(
height: 210,
onPageChanged: (index, reason) {
currentChest = chestBox.toMap().keys.toList()[index];
setState(() {});
},
enableInfiniteScroll: false,
initialPage: currentChest,
enlargeCenterPage: true,
viewportFraction: 0.6,
),
items: chestBox.toMap().entries.map((i) {
return Builder(
builder: (BuildContext context) {
return Column(children: <Widget>[
i.value.imageFile == null
? Image.asset(
'assets/chests/${i.value.imageName}',
height: 150,
)
: Image.file(
i.value.imageFile,
height: 150,
),
const SizedBox(height: 30),
Text(
i.value.name,
style: const TextStyle(fontSize: 21),
),
]);
},
);
}).toList(),
),
if (chestBox.values.toList().length > 1)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: chestBox.toMap().entries.map((entry) {
return GestureDetector(
onTap: () =>
buttonCarouselController.animateToPage(entry.key),
child: Container(
width: 12.0,
height: 12.0,
margin: const EdgeInsets.symmetric(
vertical: 8.0, horizontal: 4.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
(Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black)
.withOpacity(
currentChest == entry.key ? 0.9 : 0.4)),
),
);
}).toList(),
),
SizedBox(height: 80 * ratio),
SizedBox(
width: 400,
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: orangeC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
configBox.put('currentChest', currentChest);
WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(currentChest);
_myWalletProvider.rebuildWidget();
Navigator.pushAndRemoveUntil(context,
MaterialPageRoute(builder: (context) {
return UnlockingWallet(
wallet: defaultWallet,
action: "mywallets",
);
}), ModalRoute.withName('/'));
},
child: Text(
'Ouvrir ce coffre',
style: TextStyle(
fontSize: 22,
color: backgroundColor,
fontWeight: FontWeight.w600),
),
),
),
const SizedBox(height: 20),
InkWell(
key: const Key('createNewChest'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return GenerateFastChestScreen();
}),
);
},
child: SizedBox(
width: 400,
height: 70,
child: Center(
child: Text('Créer un nouveau coffre',
style: TextStyle(
fontSize: 22,
color: orangeC,
fontWeight: FontWeight.w600))),
)),
const SizedBox(height: 10),
]),
));
}
}

View File

@ -3,9 +3,10 @@ import 'dart:async';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/wallet_options.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -19,10 +20,10 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
String generatedMnemonic; String generatedMnemonic;
NewWallet generatedWallet; NewWallet generatedWallet;
TextEditingController _mnemonicController = TextEditingController(); final TextEditingController _mnemonicController = TextEditingController();
TextEditingController _inputRestoreWord = TextEditingController(); final TextEditingController _inputRestoreWord = TextEditingController();
TextEditingController walletName = TextEditingController(); TextEditingController walletName = TextEditingController();
FocusNode _wordFocus = FocusNode(); final FocusNode _wordFocus = FocusNode();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,7 +36,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
Provider.of<WalletOptionsProvider>(context); Provider.of<WalletOptionsProvider>(context);
final int _currentChest = _myWalletProvider.getCurrentChest(); final int _currentChest = _myWalletProvider.getCurrentChest();
this._mnemonicController.text = generatedMnemonic; _mnemonicController.text = generatedMnemonic;
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
_generateWalletProvider.isAskedWordValid = false; _generateWalletProvider.isAskedWordValid = false;
@ -45,21 +46,22 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
_generateWalletProvider.isAskedWordValid = false; _generateWalletProvider.isAskedWordValid = false;
_generateWalletProvider.askedWordColor = Colors.black; _generateWalletProvider.askedWordColor = Colors.black;
}), }),
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Enregistrer ce trousseau'), child: Text('Enregistrer ce trousseau'),
)), )),
body: Center( body: Center(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 15), const SizedBox(height: 15),
Container( SizedBox(
width: 360, width: 360,
child: Text( child: Text(
'Quel est le ${_generateWalletProvider.nbrWord + 1}ème mot de votre phrase de restauration ?', 'Quel est le ${_generateWalletProvider.nbrWord + 1}ème mot de votre phrase de restauration ?',
@ -70,11 +72,11 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
)), )),
TextFormField( TextFormField(
key: Key('askedWord'), key: const Key('askedWord'),
focusNode: _wordFocus, focusNode: _wordFocus,
autofocus: true, autofocus: true,
enabled: !_generateWalletProvider.isAskedWordValid, enabled: !_generateWalletProvider.isAskedWordValid,
controller: this._inputRestoreWord, controller: _inputRestoreWord,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
onChanged: (value) { onChanged: (value) {
_generateWalletProvider.checkAskedWord( _generateWalletProvider.checkAskedWord(
@ -82,13 +84,13 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
}, },
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 30.0,
color: _generateWalletProvider.askedWordColor, color: _generateWalletProvider.askedWordColor,
fontWeight: FontWeight.w500)), fontWeight: FontWeight.w500)),
SizedBox(height: 12), const SizedBox(height: 12),
Container( SizedBox(
width: 360, width: 360,
child: Text( child: Text(
'Choisissez un nom pour votre premier portefeuille :', 'Choisissez un nom pour votre premier portefeuille :',
@ -99,21 +101,21 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
)), )),
TextFormField( TextFormField(
key: Key('walletName'), key: const Key('walletName'),
focusNode: _generateWalletProvider.walletNameFocus, focusNode: _generateWalletProvider.walletNameFocus,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow( FilteringTextInputFormatter.allow(
RegExp('[A-Za-z|0-9|\\-|_| ]')), RegExp('[A-Za-z|0-9|\\-|_| ]')),
], ],
controller: this.walletName, controller: walletName,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
onChanged: (v) { onChanged: (v) {
_generateWalletProvider.nameChanged(); _generateWalletProvider.nameChanged();
}, },
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: const TextStyle(
fontSize: 30.0, fontSize: 30.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w500)), fontWeight: FontWeight.w500)),
@ -124,7 +126,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
width: 200, width: 200,
height: 50, height: 50,
child: ElevatedButton( child: ElevatedButton(
key: Key('confirmStorage'), key: const Key('confirmStorage'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 12, elevation: 12,
primary: Colors primary: Colors
@ -133,7 +135,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
), ),
onPressed: (_generateWalletProvider onPressed: (_generateWalletProvider
.isAskedWordValid && .isAskedWordValid &&
this.walletName.text != '') walletName.text != '')
? () { ? () {
_generateWalletProvider.storeHDWChest( _generateWalletProvider.storeHDWChest(
generatedWallet, generatedWallet,
@ -146,7 +148,6 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
_myWalletProvider.listWallets = _myWalletProvider.listWallets =
_myWalletProvider _myWalletProvider
.readAllWallets(_currentChest); .readAllWallets(_currentChest);
_myWalletProvider.getDefaultWallet();
scheduleMicrotask(() { scheduleMicrotask(() {
_walletOptions.reloadBuild(); _walletOptions.reloadBuild();
_myWalletProvider.rebuildWidget(); _myWalletProvider.rebuildWidget();
@ -155,12 +156,12 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
context, ModalRoute.withName('/')); context, ModalRoute.withName('/'));
} }
: null, : null,
child: Text('Confirmer', child: const Text('Confirmer',
style: TextStyle(fontSize: 28))), style: TextStyle(fontSize: 28))),
))), ))),
SizedBox(height: 70), const SizedBox(height: 70),
Text('TRICHE PENDANT ALPHA: ' + this._mnemonicController.text, Text('TRICHE PENDANT ALPHA: ' + _mnemonicController.text,
style: TextStyle( style: const TextStyle(
fontSize: 10.0, fontSize: 10.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal)), fontWeight: FontWeight.normal)),

View File

@ -1,22 +1,26 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/myWallets/confirmWalletStorage.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/screens/myWallets/confirm_wallet_storage.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:super_tooltip/super_tooltip.dart'; import 'package:super_tooltip/super_tooltip.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class GenerateWalletsScreen extends StatelessWidget { class GenerateFastChestScreen extends StatelessWidget {
SuperTooltip tooltip; SuperTooltip tooltip;
bool hasError = false; bool hasError = false;
String validPin = 'NO PIN'; String validPin = 'NO PIN';
String currentText = ""; String currentText = "";
var pinColor = Colors.grey[300]; var pinColor = Colors.grey[300];
GlobalKey _toolTipSentence = GlobalKey(); final GlobalKey _toolTipSentence = GlobalKey();
GlobalKey _toolTipSecret = GlobalKey(); final GlobalKey _toolTipSecret = GlobalKey();
GenerateFastChestScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -25,20 +29,23 @@ class GenerateWalletsScreen extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
_generateWalletProvider.generateMnemonic(); _generateWalletProvider.generateMnemonic();
MyWalletsProvider _myWalletClass = MyWalletsProvider();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( toolbarHeight: 60 * ratio,
height: 22, title: const SizedBox(
child: Text('Générer un trousseau'), height: 22,
)), child: Text('Générer un trousseau'),
floatingActionButton: Container( )),
floatingActionButton: SizedBox(
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
child: FittedBox( child: FittedBox(
child: FloatingActionButton( child: FloatingActionButton(
heroTag: "buttonGenerateWallet", heroTag: "buttonGenerateWallet",
onPressed: () => _generateWalletProvider.generateMnemonic(), onPressed: () => _generateWalletProvider.generateMnemonic(),
child: Container( child: SizedBox(
height: 40.0, height: 40.0,
width: 40.0, width: 40.0,
child: Icon(Icons.replay, color: Colors.grey[850]), child: Icon(Icons.replay, color: Colors.grey[850]),
@ -49,7 +56,7 @@ class GenerateWalletsScreen extends StatelessWidget {
body: Builder( body: Builder(
builder: (ctx) => SafeArea( builder: (ctx) => SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
toolTips(_toolTipSentence, 'Phrase de restauration:', toolTips(_toolTipSentence, 'Phrase de restauration:',
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"), "Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
TextField( TextField(
@ -57,54 +64,52 @@ class GenerateWalletsScreen extends StatelessWidget {
controller: _generateWalletProvider.mnemonicController, controller: _generateWalletProvider.mnemonicController,
maxLines: 3, maxLines: 3,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
contentPadding: EdgeInsets.all(15.0), contentPadding: EdgeInsets.all(15.0),
), ),
style: TextStyle( style: const TextStyle(
fontSize: 22.0, fontSize: 22.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400)), fontWeight: FontWeight.w400)),
SizedBox(height: 8), const SizedBox(height: 8),
toolTips(_toolTipSecret, 'Code secret:', toolTips(_toolTipSecret, 'Code secret:',
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"), "Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( key: const Key('generatedPin'),
key: Key('generatedPin'), enabled: false,
enabled: false, controller: _generateWalletProvider.pin,
controller: _generateWalletProvider.pin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( fontSize: 30.0,
fontSize: 30.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () {
onPressed: () { _generateWalletProvider.changePinCode(
_generateWalletProvider.changePinCode( reload: false);
reload: false); },
}, ),
), ],
],
),
), ),
SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
key: Key('storeKeychain'), key: const Key('storeKeychain'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: yellowC, // background primary: yellowC, // background
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: _generateWalletProvider.walletIsGenerated onPressed: _generateWalletProvider.walletIsGenerated
? () { ? () async {
_generateWalletProvider.nbrWord = _generateWalletProvider.nbrWord =
_generateWalletProvider.getRandomInt(); _generateWalletProvider.getRandomInt();
Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return ConfirmStoreWallet( return ConfirmStoreWallet(
@ -115,11 +120,21 @@ class GenerateWalletsScreen extends StatelessWidget {
.actualWallet); .actualWallet);
}), }),
); );
await Future.delayed(
const Duration(milliseconds: 20));
await Navigator.pushAndRemoveUntil(context,
MaterialPageRoute(builder: (context) {
return UnlockingWallet(
wallet: _myWalletClass.getDefaultWallet(
configBox.get('currentChest')),
action: "mywallets",
);
}), ModalRoute.withName('/'));
} }
: null, : null,
child: Text('Enregistrer ce trousseau', child: const Text('Enregistrer ce trousseau',
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
SizedBox(height: 20), const SizedBox(height: 20),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -130,7 +145,7 @@ class GenerateWalletsScreen extends StatelessWidget {
}), }),
); );
}, },
child: Icon(Icons.print)) child: const Icon(Icons.print))
]), ]),
))); )));
} }
@ -142,21 +157,21 @@ class GenerateWalletsScreen extends StatelessWidget {
_toolTip.ensureTooltipVisible(); _toolTip.ensureTooltipVisible();
}, },
child: Tooltip( child: Tooltip(
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
key: _key, key: _key,
showDuration: Duration(seconds: 5), showDuration: const Duration(seconds: 5),
message: _message, message: _message,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox(width: 20), const SizedBox(width: 20),
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( SizedBox(
width: 30, width: 30,
height: 25, height: 25,
child: child:
Icon(Icons.info_outline, size: 22, color: orangeC)), Icon(Icons.info_outline, size: 22, color: orangeC)),
SizedBox(height: 1) const SizedBox(height: 1)
]), ]),
Text( Text(
_text, _text,
@ -165,14 +180,14 @@ class GenerateWalletsScreen extends StatelessWidget {
color: Colors.grey[600], color: Colors.grey[600],
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
SizedBox(width: 45) const SizedBox(width: 45)
]))); ])));
} }
} }
// ignore: must_be_immutable // ignore: must_be_immutable
class PrintWallet extends StatelessWidget { class PrintWallet extends StatelessWidget {
PrintWallet(this.sentence); const PrintWallet(this.sentence, {Key key}) : super(key: key);
final String sentence; final String sentence;
@ -182,7 +197,9 @@ class PrintWallet extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
appBar: AppBar(title: Text('Imprimer ce trousseau')), appBar: AppBar(
toolbarHeight: 60 * ratio,
title: const Text('Imprimer ce trousseau')),
body: PdfPreview( body: PdfPreview(
build: (format) => _generateWalletProvider.printWallet(sentence), build: (format) => _generateWalletProvider.printWallet(sentence),
), ),

View File

@ -1,13 +1,15 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ImportWalletScreen extends StatelessWidget { class ImportWalletScreen extends StatelessWidget {
const ImportWalletScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -27,26 +29,26 @@ class ImportWalletScreen extends StatelessWidget {
}, },
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
_generateWalletProvider.resetImportView(); _generateWalletProvider.resetImportView();
Navigator.of(context).pop(); Navigator.of(context).pop();
}), }),
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Importer un portefeuille'), child: Text('Importer un portefeuille'),
)), )),
body: Builder( body: Builder(
builder: (ctx) => SafeArea( builder: (ctx) => SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
TextFormField( TextFormField(
onChanged: (text) { onChanged: (text) {
if (_debounce?.isActive ?? false) if (_debounce?.isActive ?? false) {
// _generateWalletProvider.canImport = false;
// _generateWalletProvider.reloadBuild();
_debounce.cancel(); _debounce.cancel();
}
_debounce = _debounce =
Timer(const Duration(milliseconds: 200), () { Timer(const Duration(milliseconds: 200), () {
_generateWalletProvider _generateWalletProvider
@ -77,13 +79,12 @@ class ImportWalletScreen extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 15), const SizedBox(height: 15),
TextFormField( TextFormField(
onChanged: (text) { onChanged: (text) {
if (_debounce?.isActive ?? false) if (_debounce?.isActive ?? false) {
// _generateWalletProvider.canImport = false;
// _generateWalletProvider.reloadBuild();
_debounce.cancel(); _debounce.cancel();
}
_debounce = _debounce =
Timer(const Duration(milliseconds: 200), () { Timer(const Duration(milliseconds: 200), () {
_generateWalletProvider _generateWalletProvider
@ -115,7 +116,7 @@ class ImportWalletScreen extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 15), const SizedBox(height: 15),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Clipboard.setData(ClipboardData( Clipboard.setData(ClipboardData(
@ -125,41 +126,39 @@ class ImportWalletScreen extends StatelessWidget {
}, },
child: Text( child: Text(
_generateWalletProvider.cesiumPubkey.text, _generateWalletProvider.cesiumPubkey.text,
style: TextStyle( style: const TextStyle(
fontSize: 14.0, fontSize: 14.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Monospace'), fontFamily: 'Monospace'),
)), )),
SizedBox(height: 20), const SizedBox(height: 20),
toolTips(_toolTipSecret, 'Code secret:', toolTips(_toolTipSecret, 'Code secret:',
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"), "Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( enabled: false,
enabled: false, controller: _generateWalletProvider.pin,
controller: _generateWalletProvider.pin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( fontSize: 30.0,
fontSize: 30.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () {
onPressed: () { _generateWalletProvider.changePinCode(
_generateWalletProvider.changePinCode( reload: true);
reload: true); },
}, ),
), ],
],
),
), ),
SizedBox(height: 30), const SizedBox(height: 30),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: yellowC, // background primary: yellowC, // background
@ -169,19 +168,18 @@ class ImportWalletScreen extends StatelessWidget {
_generateWalletProvider.isPinChanged _generateWalletProvider.isPinChanged
? () { ? () {
_generateWalletProvider _generateWalletProvider
.importWallet( .importCesiumWallet()
context,
_generateWalletProvider
.cesiumID.text,
_generateWalletProvider
.cesiumPWD.text)
.then((value) { .then((value) {
_myWalletProvider.rebuildWidget(); _myWalletProvider.rebuildWidget();
_generateWalletProvider.resetImportView(); _generateWalletProvider.resetImportView();
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
}); });
} }
: null, : null,
child: Text('Importer ce portefeuille Cesium', child: const Text('Importer ce portefeuille Cesium',
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
]), ]),
)))); ))));
@ -194,21 +192,21 @@ class ImportWalletScreen extends StatelessWidget {
_toolTip.ensureTooltipVisible(); _toolTip.ensureTooltipVisible();
}, },
child: Tooltip( child: Tooltip(
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
key: _key, key: _key,
showDuration: Duration(seconds: 5), showDuration: const Duration(seconds: 5),
message: _message, message: _message,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox(width: 20), const SizedBox(width: 20),
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( SizedBox(
width: 30, width: 30,
height: 25, height: 25,
child: child:
Icon(Icons.info_outline, size: 22, color: orangeC)), Icon(Icons.info_outline, size: 22, color: orangeC)),
SizedBox(height: 1) const SizedBox(height: 1)
]), ]),
Text( Text(
_text, _text,
@ -217,7 +215,7 @@ class ImportWalletScreen extends StatelessWidget {
color: Colors.grey[600], color: Colors.grey[600],
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
SizedBox(width: 45) const SizedBox(width: 45)
]))); ])));
} }
} }

View File

@ -1,11 +1,13 @@
import 'dart:async'; import 'dart:async';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/choose_chest.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
@ -21,8 +23,7 @@ class UnlockingWallet extends StatelessWidget {
// ignore: close_sinks // ignore: close_sinks
StreamController<ErrorAnimationType> errorController; StreamController<ErrorAnimationType> errorController;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
bool hasError = false; var pinColor = const Color(0xffF9F9F1);
var pinColor = Color(0xffF9F9F1);
var walletPin = ''; var walletPin = '';
String resultPay; String resultPay;
@ -34,43 +35,87 @@ class UnlockingWallet extends StatelessWidget {
WalletOptionsProvider _walletOptions = WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context); Provider.of<WalletOptionsProvider>(context);
// log.d("defaultWallet: " + defaultWallet.toString()); int _pinLenght;
final int _pinLenght = _walletOptions.getPinLenght(wallet.number);
ChestData currentChest = chestBox.get(configBox.get('currentChest'));
if (currentChest.isCesium) {
_pinLenght = _walletOptions.getPinLenght(currentChest.dewif);
wallet = WalletData(derivation: -1, chest: currentChest.key);
} else {
_pinLenght = _walletOptions.getPinLenght(wallet.number);
}
errorController = StreamController<ErrorAnimationType>(); errorController = StreamController<ErrorAnimationType>();
return Scaffold( return Scaffold(
// backgroundColor: Colors.brown[600], // backgroundColor: Colors.brown[600],
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20),
Expanded( Expanded(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 150), SizedBox(height: isTall ? 80 : 20),
Text( Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.', currentChest.imageFile == null
textAlign: TextAlign.center, ? Image.asset(
style: TextStyle( 'assets/chests/${currentChest.imageName}',
fontSize: 15.0, width: isTall ? 130 : 100,
color: Colors.black, )
fontWeight: FontWeight.w400), : Image.file(
), currentChest.imageFile,
SizedBox(height: 50), width: isTall ? 130 : 100,
pinForm(context, _pinLenght, wallet.number, wallet.derivation), ),
const SizedBox(width: 5),
SizedBox(
width: 250,
child: Text(
currentChest.name,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 25,
color: Colors.black,
fontWeight: FontWeight.w700),
)),
]),
SizedBox(height: 30 * ratio),
const SizedBox(
width: 400,
child: Text(
'Pour déverrouiller votre coffre, composez votre code secret à labri des lézards indiscrets :',
style: TextStyle(
fontSize: 19,
color: Colors.black,
fontWeight: FontWeight.w400),
)),
SizedBox(height: 40 * ratio),
pinForm(context, _pinLenght),
SizedBox(height: 3 * ratio),
InkWell(
key: const Key('chooseChest'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const ChooseChest();
}),
);
},
child: SizedBox(
width: 400,
height: 70,
child: Center(
child: Text('Changer de coffre',
style: TextStyle(
fontSize: 22,
color: orangeC,
fontWeight: FontWeight.w600))),
)),
]), ]),
), ),
GestureDetector(
onTap: () {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
},
child: Icon(Icons.home))
]), ]),
)); ));
} }
Widget pinForm(context, _pinLenght, int _walletNbr, int _derivation) { Widget pinForm(context, _pinLenght) {
// var _walletPin = ''; // var _walletPin = '';
// ignore: close_sinks // ignore: close_sinks
StreamController<ErrorAnimationType> errorController = StreamController<ErrorAnimationType> errorController =
@ -82,11 +127,14 @@ class UnlockingWallet extends StatelessWidget {
Provider.of<MyWalletsProvider>(context); Provider.of<MyWalletsProvider>(context);
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context); HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
FocusNode pinFocus = FocusNode();
return Form( return Form(
key: formKey, key: formKey,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30), padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30),
child: PinCodeTextField( child: PinCodeTextField(
focusNode: pinFocus,
autoFocus: true, autoFocus: true,
appContext: context, appContext: context,
pastedTextStyle: TextStyle( pastedTextStyle: TextStyle(
@ -109,19 +157,19 @@ class UnlockingWallet extends StatelessWidget {
borderWidth: 4, borderWidth: 4,
shape: PinCodeFieldShape.box, shape: PinCodeFieldShape.box,
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
fieldHeight: 60, fieldHeight: 50 * ratio,
fieldWidth: 50, fieldWidth: 50,
activeFillColor: hasError ? Colors.blueAccent : Colors.black, activeFillColor: Colors.black,
), ),
cursorColor: Colors.black, cursorColor: Colors.black,
animationDuration: Duration(milliseconds: 300), animationDuration: const Duration(milliseconds: 300),
textStyle: TextStyle(fontSize: 20, height: 1.6), textStyle: const TextStyle(fontSize: 20, height: 1.6),
backgroundColor: Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
enableActiveFill: false, enableActiveFill: false,
errorAnimationController: errorController, errorAnimationController: errorController,
controller: _enterPin, controller: _enterPin,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
boxShadows: [ boxShadows: const [
BoxShadow( BoxShadow(
offset: Offset(0, 1), offset: Offset(0, 1),
color: Colors.black12, color: Colors.black12,
@ -131,24 +179,23 @@ class UnlockingWallet extends StatelessWidget {
onCompleted: (_pin) async { onCompleted: (_pin) async {
log.d("Completed"); log.d("Completed");
_myWalletProvider.pinCode = _pin; _myWalletProvider.pinCode = _pin;
final resultWallet = await _walletOptions.readLocalWallet( final String resultWallet = await _walletOptions.readLocalWallet(
context, this.wallet, _pin.toUpperCase(), _pinLenght); context, wallet, _pin.toUpperCase(), _pinLenght);
// _myWalletProvider.pinCode = _pin.toUpperCase(); // _myWalletProvider.pinCode = _pin.toUpperCase();
_myWalletProvider.pinLenght = _pinLenght; _myWalletProvider.pinLenght = _pinLenght;
if (resultWallet == 'bad') { if (resultWallet == 'bad') {
errorController.add(ErrorAnimationType errorController.add(ErrorAnimationType
.shake); // Triggering error shake animation .shake); // Triggering error shake animation
hasError = true;
pinColor = Colors.red[600]; pinColor = Colors.red[600];
_walletOptions.reloadBuild(); _walletOptions.reloadBuild();
pinFocus.requestFocus();
} else { } else {
pinColor = Colors.green[400]; pinColor = Colors.green[400];
// await Future.delayed(Duration(milliseconds: 50)); // await Future.delayed(Duration(milliseconds: 50));
if (action == "mywallets") { if (action == "mywallets") {
Navigator.pushNamed(formKey.currentContext, '/mywallets'); Navigator.pushNamed(formKey.currentContext, '/mywallets');
} else if (action == "pay") { } else if (action == "pay") {
print("Go payments");
resultPay = resultPay =
await _historyProvider.pay(context, _pin.toUpperCase()); await _historyProvider.pay(context, _pin.toUpperCase());
await _paymentsResult(context); await _paymentsResult(context);
@ -156,8 +203,8 @@ class UnlockingWallet extends StatelessWidget {
} }
}, },
onChanged: (value) { onChanged: (value) {
if (pinColor != Color(0xFFA4B600)) { if (pinColor != const Color(0xFFA4B600)) {
pinColor = Color(0xFFA4B600); pinColor = const Color(0xFFA4B600);
} }
}, },
)), )),
@ -173,10 +220,10 @@ class UnlockingWallet extends StatelessWidget {
title: Text(resultPay == "Success" title: Text(resultPay == "Success"
? 'Paiement effecuté avec succès !' ? 'Paiement effecuté avec succès !'
: "Une erreur s'est produite lors du paiement"), : "Une erreur s'est produite lors du paiement"),
content: SingleChildScrollView(child: Text('')), content: const SingleChildScrollView(child: Text('')),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("OK"), child: const Text("OK"),
onPressed: () { onPressed: () {
Navigator.popUntil( Navigator.popUntil(
context, context,

View File

@ -1,12 +1,13 @@
import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart'; import 'package:gecko/models/queries.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -42,15 +43,14 @@ class WalletOptions extends StatelessWidget {
_walletOptions.nameController.text.length >= 15 _walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2 ? _nbrLinesName = 2
: _nbrLinesName = 1; : _nbrLinesName = 1;
if (_walletOptions.nameController.text.length >= 26 && isTall) if (_walletOptions.nameController.text.length >= 26 && isTall) {
_nbrLinesName = 3; _nbrLinesName = 3;
}
_walletOptions.walletID = [0, wallet.number]; WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(_currentChest);
_myWalletProvider.getDefaultWallet(); _walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
_walletOptions.isDefaultWallet =
(defaultWallet.id()[1] == _walletOptions.walletID[1]);
int currentChest = _myWalletProvider.getCurrentChest(); int currentChest = _myWalletProvider.getCurrentChest();
@ -69,8 +69,9 @@ class WalletOptions extends StatelessWidget {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
_walletOptions.isEditing = false; _walletOptions.isEditing = false;
_walletOptions.isBalanceBlur = true; _walletOptions.isBalanceBlur = true;
@ -97,27 +98,43 @@ class WalletOptions extends StatelessWidget {
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
yellowC, yellowC,
Color(0xfffafafa), const Color(0xfffafafa),
], ],
)), )),
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 25), const SizedBox(width: 25),
InkWell( InkWell(
onTap: () async { onTap: () async {
await _walletOptions.changeAvatar(); File newAvatar =
await _walletOptions.changeAvatar();
if (newAvatar != null) {
wallet.imageFile = newAvatar;
}
_walletOptions.reloadBuild();
}, },
child: Image.asset( child: wallet.imageFile == null
'assets/chopp-gecko2.png', ? Image.asset(
)), 'assets/avatars/${wallet.imageName}',
width: 110,
)
: Image.file(
wallet.imageFile,
width: 110,
)),
InkWell( InkWell(
onTap: () async { onTap: () async {
await _walletOptions.changeAvatar(); File newAvatar =
await _walletOptions.changeAvatar();
if (newAvatar != null) {
wallet.imageFile = newAvatar;
}
_walletOptions.reloadBuild();
}, },
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Image.asset( Image.asset(
'assets/walletOptions/camera.png', 'assets/walletOptions/camera.png',
), ),
SizedBox(height: 100) const SizedBox(height: 100)
])), ])),
Column(children: <Widget>[ Column(children: <Widget>[
Row(children: <Widget>[ Row(children: <Widget>[
@ -125,13 +142,14 @@ class WalletOptions extends StatelessWidget {
SizedBox( SizedBox(
width: 260, width: 260,
child: TextField( child: TextField(
key: Key('walletName'), key: const Key('walletName'),
autofocus: false,
focusNode: _walletOptions.walletNameFocus, focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing, enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController, controller: _walletOptions.nameController,
maxLines: _nbrLinesName, maxLines: _nbrLinesName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
@ -160,7 +178,7 @@ class WalletOptions extends StatelessWidget {
} }
if (result.isLoading) { if (result.isLoading) {
return Text('Loading'); return const Text('Loading');
} }
// List repositories = result.data['viewer']['repositories']['nodes']; // List repositories = result.data['viewer']['repositories']['nodes'];
@ -187,7 +205,7 @@ class WalletOptions extends StatelessWidget {
sigmaY: _walletOptions.isBalanceBlur sigmaY: _walletOptions.isBalanceBlur
? 5 ? 5
: 0), : 0),
child: Text('$wBalanceUD', child: Text(wBalanceUD,
style: TextStyle( style: TextStyle(
fontSize: isTall ? 20 : 18, fontSize: isTall ? 20 : 18,
color: Colors.black)), color: Colors.black)),
@ -205,9 +223,9 @@ class WalletOptions extends StatelessWidget {
// ); // );
}, },
), ),
SizedBox(height: 5), const SizedBox(height: 5),
InkWell( InkWell(
key: Key('displayBalance'), key: const Key('displayBalance'),
onTap: () { onTap: () {
_walletOptions.bluringBalance(); _walletOptions.bluringBalance();
}, },
@ -217,41 +235,17 @@ class WalletOptions extends StatelessWidget {
: 'assets/walletOptions/icon_oeuil_close.png', : 'assets/walletOptions/icon_oeuil_close.png',
)), )),
]), ]),
SizedBox(width: 0), const SizedBox(width: 0),
Column(children: <Widget>[ Column(children: <Widget>[
InkWell( InkWell(
key: Key('renameWallet'), key: const Key('renameWallet'),
onTap: () async { onTap: () async {
// _walletOptions.isEditing = true; _isNewNameValid =
// _walletOptions.reloadBuild(); _walletOptions.editWalletName(wallet.id(),
// _walletOptions.walletNameFocus isCesium: false);
// .requestFocus(); await Future.delayed(
_isNewNameValid = await _walletOptions const Duration(milliseconds: 30));
.editWalletName(_walletOptions.walletID); _walletOptions.walletNameFocus.requestFocus();
// .then((_) {
// _walletOptions.walletNameFocus
// .requestFocus();
// _walletOptions.reloadBuild();
// });
// .then(
// (_result) {
// if (_result == true) {
// WidgetsBinding.instance
// .addPostFrameCallback((_) {
// _myWalletProvider.listWallets =
// _myWalletProvider
// .readAllWallets(
// _currentChest);
// _myWalletProvider.rebuildWidget();
// });
// Navigator.popUntil(
// context,
// ModalRoute.withName('/mywallets'),
// );
// }
// },
// );
}, },
child: ClipRRect( child: ClipRRect(
child: Image.asset( child: Image.asset(
@ -261,10 +255,7 @@ class WalletOptions extends StatelessWidget {
width: 20, width: 20,
height: 20), height: 20),
)), )),
// Image.asset( const SizedBox(
// 'assets/walletOptions/edit.png',
// ),
SizedBox(
height: 60, height: 60,
) )
]) ])
@ -279,11 +270,11 @@ class WalletOptions extends StatelessWidget {
return snapshot.data != null return snapshot.data != null
? Image.memory(snapshot.data, ? Image.memory(snapshot.data,
height: isTall ? 300 : 270) height: isTall ? 300 : 270)
: Text('-', style: TextStyle(fontSize: 20)); : const Text('-', style: TextStyle(fontSize: 20));
}), }),
SizedBox(height: 15 * ratio), SizedBox(height: 15 * ratio),
GestureDetector( GestureDetector(
key: Key('copyPubkey'), key: const Key('copyPubkey'),
onTap: () { onTap: () {
Clipboard.setData( Clipboard.setData(
ClipboardData(text: _walletOptions.pubkey.text)); ClipboardData(text: _walletOptions.pubkey.text));
@ -292,30 +283,29 @@ class WalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/key.png', 'assets/walletOptions/key.png',
), ),
SizedBox(width: 10), const SizedBox(width: 20),
Text("${shortPubkey.split(':')[0]}:", Text("${shortPubkey.split(':')[0]}:",
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace', fontFamily: 'Monospace',
color: Colors.black)), color: Colors.black)),
Text(shortPubkey.split(':')[1], Text(shortPubkey.split(':')[1],
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace')), fontFamily: 'Monospace')),
SizedBox(width: 15), const SizedBox(width: 15),
SizedBox( SizedBox(
height: 40, height: 40,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.circular(8),
new BorderRadius.circular(8),
), ),
elevation: 1, elevation: 1,
primary: orangeC, // background primary: orangeC, // background
@ -330,7 +320,7 @@ class WalletOptions extends StatelessWidget {
Image.asset( Image.asset(
'assets/walletOptions/copy-white.png', 'assets/walletOptions/copy-white.png',
), ),
SizedBox(width: 7), const SizedBox(width: 7),
Text('Copier', Text('Copier',
style: TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
@ -339,7 +329,7 @@ class WalletOptions extends StatelessWidget {
]))), ]))),
SizedBox(height: 10 * ratio), SizedBox(height: 10 * ratio),
InkWell( InkWell(
key: Key('displayHistory'), key: const Key('displayHistory'),
onTap: () { onTap: () {
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text, _historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
goHistory: true); goHistory: true);
@ -347,22 +337,23 @@ class WalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/clock.png', 'assets/walletOptions/clock.png',
), ),
SizedBox(width: 12), const SizedBox(width: 22),
Text('Historique des transactions', const Text('Historique des transactions',
style: style:
TextStyle(fontSize: 20, color: Colors.black)), TextStyle(fontSize: 20, color: Colors.black)),
]))), ]))),
SizedBox(height: 12 * ratio), SizedBox(height: 12 * ratio),
InkWell( InkWell(
key: Key('setDefaultWallet'), key: const Key('setDefaultWallet'),
onTap: !_walletOptions.isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () { ? () {
defaultWallet = wallet; defaultWallet = wallet;
configBox.put('defaultWallet', wallet.id()); chestBox.get(currentChest).defaultWallet =
wallet.number;
_myWalletProvider.readAllWallets(_currentChest); _myWalletProvider.readAllWallets(_currentChest);
_myWalletProvider.rebuildWidget(); _myWalletProvider.rebuildWidget();
} }
@ -370,14 +361,14 @@ class WalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 31), const SizedBox(width: 31),
CircleAvatar( CircleAvatar(
backgroundColor: Colors.grey[ backgroundColor: Colors.grey[
_walletOptions.isDefaultWallet ? 300 : 500], _walletOptions.isDefaultWallet ? 300 : 500],
child: Image.asset( child: Image.asset(
'assets/walletOptions/android-checkmark.png', 'assets/walletOptions/android-checkmark.png',
)), )),
SizedBox(width: 12), const SizedBox(width: 22),
Text( Text(
_walletOptions.isDefaultWallet _walletOptions.isDefaultWallet
? 'Ce portefeuille est celui par defaut' ? 'Ce portefeuille est celui par defaut'
@ -391,7 +382,7 @@ class WalletOptions extends StatelessWidget {
SizedBox(height: 17 * ratio), SizedBox(height: 17 * ratio),
if (!_walletOptions.isDefaultWallet) if (!_walletOptions.isDefaultWallet)
InkWell( InkWell(
key: Key('deleteWallet'), key: const Key('deleteWallet'),
onTap: !_walletOptions.isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () async { ? () async {
await _walletOptions.deleteWallet( await _walletOptions.deleteWallet(
@ -405,12 +396,12 @@ class WalletOptions extends StatelessWidget {
} }
: null, : null,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 33), const SizedBox(width: 33),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
), ),
SizedBox(width: 14), const SizedBox(width: 24),
Text('Supprimer ce portefeuille', const Text('Supprimer ce portefeuille',
style: TextStyle( style: TextStyle(
fontSize: 20, color: Color(0xffD80000))), fontSize: 20, color: Color(0xffD80000))),
])), ])),

View File

@ -1,252 +0,0 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletData.dart';
import 'package:gecko/models/walletOptions.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/commonElements.dart';
import 'package:gecko/screens/myWallets/walletOptions.dart';
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class WalletsHome extends StatelessWidget {
final _derivationKey = GlobalKey<FormState>();
int firstWalletDerivation;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
MyWalletsProvider myWalletProvider =
Provider.of<MyWalletsProvider>(context);
final int _currentChest = myWalletProvider.getCurrentChest();
myWalletProvider.listWallets =
myWalletProvider.readAllWallets(_currentChest);
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
if (myWalletProvider.listWallets.isEmpty) {
firstWalletDerivation = myWalletProvider.listWallets[0].derivation;
myWalletProvider.getDefaultWallet();
}
log.d("${myWalletProvider.pinCode},${myWalletProvider.pinLenght}");
return WillPopScope(
onWillPop: () {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
return Future<bool>.value(true);
},
child: Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
}),
title: Text('Mes portefeuilles',
key: Key('myWallets'),
style: TextStyle(color: Colors.grey[850])),
backgroundColor: Color(0xffFFD58D),
),
floatingActionButton: Visibility(
visible: (isWalletsExists && firstWalletDerivation != -1),
child: Container(
height: 80.0,
width: 80.0,
child: FittedBox(
child: FloatingActionButton(
key: Key('addDerivation'),
heroTag: "buttonGenerateWallet",
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return addNewDerivation(context, 1);
});
},
child: Container(
height: 40,
width: 40,
child: Icon(Icons.person_add_alt_1_rounded,
color: Colors.grey[850])),
backgroundColor: floattingYellow)))),
body: SafeArea(
child: !isWalletsExists
? NoKeyChainScreen()
: myWalletsTiles(context))));
}
Widget myWalletsTiles(BuildContext context) {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context);
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
if (!isWalletsExists) {
return Text('');
}
if (_myWalletProvider.listWallets.isEmpty) {
return Expanded(
child: Column(children: <Widget>[
Center(
child: Text(
'Veuillez générer votre premier portefeuille',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
)),
]));
}
List _listWallets = _myWalletProvider.listWallets;
return GridView.count(
key: Key('listWallets'),
crossAxisCount: 2,
childAspectRatio: 1,
crossAxisSpacing: 0,
mainAxisSpacing: 0,
children: <Widget>[
for (WalletData _repository in _listWallets)
Padding(
padding: EdgeInsets.all(16),
child: GestureDetector(
onTap: () async {
await _walletOptions.readLocalWallet(
context,
_repository,
_myWalletProvider.pinCode,
_myWalletProvider.pinLenght);
Navigator.push(
context,
SmoothTransition(
page: WalletOptions(
wallet: _repository,
)));
// Navigator.push(context,
// MaterialPageRoute(builder: (context) {
// return UnlockingWallet(wallet: _repository);
// }));
},
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(12)),
child: Column(children: <Widget>[
Expanded(
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
gradient: RadialGradient(
radius: 1,
colors: [
Colors.green[100],
Colors.green[500],
],
)),
child:
// SvgPicture.asset('assets/chopp-gecko2.png',
// semanticsLabel: 'Gecko', height: 48),
Image.asset(
'assets/chopp-gecko2.png',
),
)),
ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(12))),
// contentPadding: const EdgeInsets.only(left: 7.0),
tileColor:
_repository.id()[1] == defaultWallet.id()[1]
? orangeC
: Color(0xffFFD58D),
// leading: Text('IMAGE'),
// subtitle: Text(_repository.split(':')[3],
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
title: Center(
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 5),
child: Text(_repository.name,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
color: _repository.id()[1] ==
defaultWallet.id()[1]
? Color(0xffF9F9F1)
: Colors.black)))),
// dense: true,
onTap: () {
Navigator.push(
context,
SmoothTransition(
page: WalletOptions(
wallet: _repository,
)));
},
)
]))))
]);
}
Widget addNewDerivation(context, int _walletNbr) {
final TextEditingController _newDerivationName = TextEditingController();
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
return AlertDialog(
content: Stack(
clipBehavior: Clip.hardEdge,
children: <Widget>[
Form(
key: _derivationKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('Nom du portefeuille:'),
Padding(
padding: EdgeInsets.all(8.0),
child: TextFormField(
key: Key('DerivationNameKey'),
controller: _newDerivationName,
textAlign: TextAlign.center,
autofocus: true,
),
),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
key: Key('validDerivation'),
style: ElevatedButton.styleFrom(
elevation: 1,
primary: yellowC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
await _myWalletProvider
.generateNewDerivation(
context, _newDerivationName.text)
.then((_) => _newDerivationName.text == '');
},
child: Text("Créer")),
)
],
),
),
],
),
);
}
}

View File

@ -0,0 +1,479 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/wallet_options.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/myWallets/cesium_wallet_options.dart';
import 'package:gecko/screens/myWallets/chest_options.dart';
import 'package:gecko/screens/myWallets/choose_chest.dart';
import 'package:gecko/screens/myWallets/wallet_options.dart';
import 'package:gecko/screens/onBoarding/0_no_keychain_found.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
class WalletsHome extends StatelessWidget {
final _derivationKey = GlobalKey<FormState>();
WalletsHome({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
MyWalletsProvider myWalletProvider =
Provider.of<MyWalletsProvider>(context);
final int _currentChestNumber = myWalletProvider.getCurrentChest();
final ChestData _currentChest = chestBox.get(_currentChestNumber);
bool isWalletsExists;
if (!_currentChest.isCesium) {
myWalletProvider.listWallets =
myWalletProvider.readAllWallets(_currentChestNumber);
}
isWalletsExists = myWalletProvider.checkIfWalletExist();
return WillPopScope(
onWillPop: () {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
return Future<bool>.value(true);
},
child: Scaffold(
appBar: AppBar(
toolbarHeight: 60 * ratio,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
}),
title: Text(_currentChest.name,
key: const Key('myWallets'),
style: TextStyle(color: Colors.grey[850])),
backgroundColor: const Color(0xffFFD58D),
),
body: SafeArea(
child: !isWalletsExists
? const NoKeyChainScreen()
: _currentChest.isCesium
? cesiumWalletOptions(
context, _currentChest, myWalletProvider)
: myWalletsTiles(context),
),
),
);
}
// Widget cesiumWalletOptions(BuildContext context) {
// return Column(children: const [
// Center(child: Text('This is a Cesium wallet')),
// ]);
// }
Widget chestOptions(
BuildContext context, MyWalletsProvider _myWalletProvider) {
return Column(children: [
const SizedBox(height: 50),
SizedBox(
height: 120,
width: 445,
child: ElevatedButton.icon(
icon: Image.asset(
'assets/chests/config.png',
),
style: ElevatedButton.styleFrom(
elevation: 2,
primary: floattingYellow, // background
onPrimary: Colors.black, // foreground
),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return ChestOptions(walletProvider: _myWalletProvider);
}),
),
label: const Text(
" Paramétrer ce coffre",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w700,
color: Color(0xff8a3c0f),
),
),
)),
const SizedBox(height: 30),
SizedBox(
height: 120,
width: 445,
child: ElevatedButton.icon(
icon: Image.asset('assets/chests/miniChests.png'),
style: ElevatedButton.styleFrom(
elevation: 2,
primary: floattingYellow, // background
onPrimary: Colors.black, // foreground
),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const ChooseChest();
}),
),
label: const Text(
" Changer de coffre",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w700,
color: Color(0xff8a3c0f),
),
),
)),
const SizedBox(height: 30)
]);
}
Widget myWalletsTiles(BuildContext context) {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context);
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
if (!isWalletsExists) {
return const Text('');
}
if (_myWalletProvider.listWallets.isEmpty) {
return Expanded(
child: Column(children: const <Widget>[
Center(
child: Text(
'Veuillez générer votre premier portefeuille',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
)),
]));
}
List _listWallets = _myWalletProvider.listWallets;
WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
return CustomScrollView(slivers: <Widget>[
const SliverToBoxAdapter(child: SizedBox(height: 20)),
SliverGrid.count(
key: const Key('listWallets'),
crossAxisCount: 2,
childAspectRatio: 1,
crossAxisSpacing: 0,
mainAxisSpacing: 0,
children: <Widget>[
for (WalletData _repository in _listWallets)
Padding(
padding: const EdgeInsets.all(16),
child: GestureDetector(
onTap: () async {
await _walletOptions.readLocalWallet(
context,
_repository,
_myWalletProvider.pinCode,
_myWalletProvider.pinLenght);
Navigator.push(
context,
SmoothTransition(
page: WalletOptions(
wallet: _repository,
)));
// Navigator.push(context,
// MaterialPageRoute(builder: (context) {
// return UnlockingWallet(wallet: _repository);
// }));
},
child: ClipOvalShadow(
shadow: const Shadow(
color: Colors.transparent,
offset: Offset(0, 0),
blurRadius: 5,
),
clipper: CustomClipperOval(),
child: ClipRRect(
borderRadius:
const BorderRadius.all(Radius.circular(12)),
child: Column(children: <Widget>[
Expanded(
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
gradient: RadialGradient(
radius: 0.6,
colors: [
Colors.green[400],
const Color(0xFFE7E7A6),
],
)),
child:
// SvgPicture.asset('assets/chopp-gecko2.png',
// semanticsLabel: 'Gecko', height: 48),
_repository.imageFile == null
? Image.asset(
'assets/avatars/${_repository.imageName}',
alignment: Alignment.bottomCenter,
scale: 0.5,
)
: Image.file(
_repository.imageFile,
alignment: Alignment.bottomCenter,
scale: 0.5,
),
)),
// balanceBuilder(context, _walletOptions.pubkey.text),
ListTile(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(12))),
// contentPadding: const EdgeInsets.only(left: 7.0),
tileColor:
_repository.id()[1] == defaultWallet.id()[1]
? orangeC
: const Color(0xffFFD58D),
// leading: Text('IMAGE'),
// subtitle: Text(_repository.split(':')[3],
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
title: Center(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 5),
child: Text(
_repository.name,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.0,
color: _repository.id()[1] ==
defaultWallet.id()[1]
? const Color(0xffF9F9F1)
: Colors.black,
fontStyle: FontStyle.italic),
),
),
),
// dense: true,
onTap: () {
Navigator.push(
context,
SmoothTransition(
page: WalletOptions(
wallet: _repository,
),
),
);
},
)
]),
),
),
)),
addNewDerivation(context),
// SizedBox(height: 1),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 35),
// child: Text(
// 'Ajouter un portefeuille',
// textAlign: TextAlign.center,
// style: TextStyle(fontSize: 18),
// ))
]),
// SliverToBoxAdapter(child: Spacer()),
SliverToBoxAdapter(child: chestOptions(context, _myWalletProvider)),
]);
}
Widget balanceBuilder(context, String _pubkey) {
return Query(
options: QueryOptions(
document: gql(getBalance),
variables: {
'pubkey': _pubkey,
},
// pollInterval: Duration(seconds: 1),
),
builder: (QueryResult result,
{VoidCallback refetch, FetchMore fetchMore}) {
if (result.hasException) {
return Text(result.exception.toString());
}
if (result.isLoading) {
return const Text('Loading');
}
String wBalanceUD;
if (result.data['balance'] == null) {
wBalanceUD = '0.0';
} else {
int wBalanceG1 = result.data['balance']['amount'];
int currentUD = result.data['currentUd']['amount'];
double wBalanceUDBrut = wBalanceG1 / currentUD; // .toString();
wBalanceUD =
double.parse((wBalanceUDBrut).toStringAsFixed(2)).toString();
}
return Text(wBalanceUD);
});
}
Widget addNewDerivation(context) {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
String _newDerivationName =
'Portefeuille ${_myWalletProvider.listWallets.last.number + 2}';
return Padding(
padding: const EdgeInsets.all(16),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Column(children: <Widget>[
Expanded(
child: InkWell(
key: const Key('addDerivation'),
onTap: () async {
await _myWalletProvider.generateNewDerivation(
context, _newDerivationName);
},
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(color: floattingYellow),
child: const Center(
child: Text(
'+',
style: TextStyle(
fontSize: 150,
fontWeight: FontWeight.w700,
color: Color(0xFFFCB437)),
)),
)),
),
])));
}
Widget addNewDerivationPopup(context) {
final TextEditingController _newDerivationName = TextEditingController();
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
return AlertDialog(
content: Stack(
clipBehavior: Clip.hardEdge,
children: <Widget>[
Form(
key: _derivationKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const Text('Nom du portefeuille:'),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
key: const Key('DerivationNameKey'),
controller: _newDerivationName,
textAlign: TextAlign.center,
autofocus: true,
),
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
key: const Key('validDerivation'),
style: ElevatedButton.styleFrom(
elevation: 1,
primary: yellowC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
await _myWalletProvider
.generateNewDerivation(
context, _newDerivationName.text)
.then((_) => _newDerivationName.text == '');
},
child: const Text("Créer")),
)
],
),
),
],
),
);
}
}
// extension Range on num {
// bool isBetween(num from, num to) {
// return from < this && this < to;
// }
// }
class CustomClipperOval extends CustomClipper<Rect> {
@override
Rect getClip(Size size) {
return Rect.fromCircle(
center: Offset(size.width / 2, size.width / 2),
radius: size.width / 2 + 3);
}
@override
bool shouldReclip(CustomClipper<Rect> oldClipper) {
return false;
}
}
class ClipOvalShadow extends StatelessWidget {
final Shadow shadow;
final CustomClipper<Rect> clipper;
final Widget child;
const ClipOvalShadow({
Key key,
@required this.shadow,
@required this.clipper,
@required this.child,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return CustomPaint(
painter: _ClipOvalShadowPainter(
clipper: clipper,
shadow: shadow,
),
child: ClipRect(child: child, clipper: clipper),
);
}
}
class _ClipOvalShadowPainter extends CustomPainter {
final Shadow shadow;
final CustomClipper<Rect> clipper;
_ClipOvalShadowPainter({@required this.shadow, @required this.clipper});
@override
void paint(Canvas canvas, Size size) {
var paint = shadow.toPaint();
var clipRect = clipper.getClip(size).shift(const Offset(0, 0));
canvas.drawOval(clipRect, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}

View File

@ -1,16 +1,14 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/myWallets/importWallet.dart'; import 'package:gecko/screens/myWallets/import_wallet.dart';
import 'package:gecko/screens/onBoarding/1.dart'; import 'package:gecko/screens/onBoarding/1.dart';
// import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart';
// ignore: must_be_immutable
class NoKeyChainScreen extends StatelessWidget { class NoKeyChainScreen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); const NoKeyChainScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -25,16 +23,16 @@ class NoKeyChainScreen extends StatelessWidget {
common.onboardingProgressBar(context, 'Mes portefeuilles', 0), common.onboardingProgressBar(context, 'Mes portefeuilles', 0),
common.bubbleSpeak( common.bubbleSpeak(
"Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.", "Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.",
textKey: Key('textOnboarding')), textKey: const Key('textOnboarding')),
SizedBox(height: 90), const SizedBox(height: 90),
Container( Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
key: Key('goStep1'), key: const Key('goStep1'),
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: const Padding(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: Image( child: Image(
image: AssetImage('assets/onBoarding/wallet.png'), image: AssetImage('assets/onBoarding/wallet.png'),
@ -47,7 +45,7 @@ class NoKeyChainScreen extends StatelessWidget {
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -59,8 +57,8 @@ class NoKeyChainScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 15), const SizedBox(height: 15),
Text( const Text(
"Créer un nouveau\nportefeuille", "Créer un nouveau\nportefeuille",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -68,15 +66,15 @@ class NoKeyChainScreen extends StatelessWidget {
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
), ),
SizedBox(height: 70), const SizedBox(height: 70),
Container( Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: Padding(
padding: EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: child:
// Image( // Image(
// image: AssetImage('assets/cesium_bw3.png'), // image: AssetImage('assets/cesium_bw3.png'),
@ -86,11 +84,11 @@ class NoKeyChainScreen extends StatelessWidget {
), ),
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
SlideLeftRoute(page: ImportWalletScreen())); SlideLeftRoute(page: const ImportWalletScreen()));
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -102,8 +100,8 @@ class NoKeyChainScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 10), const SizedBox(height: 10),
Text( const Text(
"Importer un\nportefeuille Cesium", "Importer un\nportefeuille Cesium",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 13), style: TextStyle(color: Colors.black, fontSize: 13),

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/2.dart'; import 'package:gecko/screens/onBoarding/2.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
@ -11,6 +13,8 @@ class OnboardingStepOne extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 1; final int progress = 1;
OnboardingStepOne({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -24,8 +28,8 @@ class OnboardingStepOne extends StatelessWidget {
context, 'Nouveau portefeuilles', progress), context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Il semblerait que vous nayez pas encore de trousseau.\n\nUn trousseau vous permet de gérer un ou plusieurs portefeuilles.", "Il semblerait que vous nayez pas encore de trousseau.\n\nUn trousseau vous permet de gérer un ou plusieurs portefeuilles.",
textKey: Key('step1')), textKey: const Key('step1')),
SizedBox(height: 90), const SizedBox(height: 90),
Image.asset( Image.asset(
'assets/onBoarding/keys-and-wallets-horizontal.png', 'assets/onBoarding/keys-and-wallets-horizontal.png',
height: 200, height: 200,
@ -37,7 +41,7 @@ class OnboardingStepOne extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep2'), key: const Key('goStep2'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,10 +53,10 @@ class OnboardingStepOne extends StatelessWidget {
FaderTransition( FaderTransition(
page: OnboardingStepTwo(), isFast: true)); page: OnboardingStepTwo(), isFast: true));
}, },
child: Text('Créer mon trousseau', child: const Text('Créer mon trousseau',
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/11.dart'; import 'package:gecko/screens/onBoarding/11.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepTwelve extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 9; final int progress = 9;
OnboardingStepTwelve({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,9 +26,9 @@ class OnboardingStepTwelve extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.", "Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.",
textKey: Key('step10'), textKey: const Key('step10'),
), ),
SizedBox(height: 10), const SizedBox(height: 10),
Image.asset( Image.asset(
'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png', 'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png',
height: 410 * ratio, height: 410 * ratio,
@ -36,7 +40,7 @@ class OnboardingStepTwelve extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep11'), key: const Key('goStep11'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,7 +53,7 @@ class OnboardingStepTwelve extends StatelessWidget {
page: OnboardingStepThirteen(), isFast: true), page: OnboardingStepThirteen(), isFast: true),
); );
}, },
child: Text("Générer le code secret", child: const Text("Générer le code secret",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: isTall ? 80 : 40), SizedBox(height: isTall ? 80 : 40),

View File

@ -1,10 +1,12 @@
// ignore_for_file: file_names
import 'dart:ui'; import 'dart:ui';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/12.dart'; import 'package:gecko/screens/onBoarding/12.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -13,6 +15,8 @@ class OnboardingStepThirteen extends StatelessWidget {
NewWallet generatedWallet; NewWallet generatedWallet;
final int progress = 10; final int progress = 10;
OnboardingStepThirteen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -32,51 +36,49 @@ class OnboardingStepThirteen extends StatelessWidget {
// initialData: '...', // initialData: '...',
builder: (context, snapshot) { builder: (context, snapshot) {
generatedWallet = snapshot.data; generatedWallet = snapshot.data;
return Visibility(visible: false, child: Text('')); return const Visibility(visible: false, child: Text(''));
}), }),
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich( common.bubbleSpeakRich(
<TextSpan>[ <TextSpan>[
TextSpan( const TextSpan(
text: text:
"Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "), "Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "),
TextSpan( const TextSpan(
text: 'à chaque fois', text: 'à chaque fois',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan( const TextSpan(
text: text:
" que vous voudrez effectuer un paiement sur cet appareil."), " que vous voudrez effectuer un paiement sur cet appareil."),
], ],
textKey: Key('step11'), textKey: const Key('step11'),
), ),
SizedBox(height: 100), const SizedBox(height: 100),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( key: const Key('generatedPin'),
key: Key('generatedPin'), enabled: false,
enabled: false, controller: _generateWalletProvider.pin,
controller: _generateWalletProvider.pin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( letterSpacing: 5,
letterSpacing: 5, fontSize: 35.0,
fontSize: 35.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () async {
onPressed: () async { generatedWallet = await _generateWalletProvider
generatedWallet = await _generateWalletProvider .changePinCode(reload: false);
.changePinCode(reload: false); },
}, ),
), ],
],
),
), ),
Expanded( Expanded(
child: Align( child: Align(
@ -85,25 +87,25 @@ class OnboardingStepThirteen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('changeSecretCode'), key: const Key('changeSecretCode'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffFFD58D), primary: const Color(0xffFFD58D),
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () async { onPressed: () async {
generatedWallet = await _generateWalletProvider generatedWallet = await _generateWalletProvider
.changePinCode(reload: false); .changePinCode(reload: false);
}, },
child: Text("Choisir un autre code secret", child: const Text("Choisir un autre code secret",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 25), const SizedBox(height: 25),
SizedBox( SizedBox(
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep12'), key: const Key('goStep12'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -120,10 +122,10 @@ class OnboardingStepThirteen extends StatelessWidget {
isFast: true), isFast: true),
); );
}, },
child: Text("J'ai noté mon code secret", child: const Text("J'ai noté mon code secret",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,13 +1,15 @@
// ignore_for_file: file_names
import 'dart:async'; import 'dart:async';
import 'dart:ui'; import 'dart:ui';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/13_congratulations.dart'; import 'package:gecko/screens/onBoarding/13_congratulations.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,7 +24,7 @@ class OnboardingStepFourteen extends StatelessWidget {
NewWallet generatedWallet; NewWallet generatedWallet;
final int progress = 11; final int progress = 11;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
var pinColor = Color(0xFFA4B600); var pinColor = const Color(0xFFA4B600);
bool hasError = false; bool hasError = false;
@override @override
@ -43,7 +45,7 @@ class OnboardingStepFourteen extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après cest fini, promis-juré-gecko).", "Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après cest fini, promis-juré-gecko).",
textKey: Key('step12'), textKey: const Key('step12'),
), ),
SizedBox(height: isTall ? 80 : 10), SizedBox(height: isTall ? 80 : 10),
pinForm(context, _walletOptions, _pinLenght, 1, 3) pinForm(context, _walletOptions, _pinLenght, 1, 3)
@ -70,7 +72,7 @@ class OnboardingStepFourteen extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30), padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
child: PinCodeTextField( child: PinCodeTextField(
key: Key('formKey2'), key: const Key('formKey2'),
autoFocus: true, autoFocus: true,
appContext: context, appContext: context,
pastedTextStyle: TextStyle( pastedTextStyle: TextStyle(
@ -98,14 +100,14 @@ class OnboardingStepFourteen extends StatelessWidget {
activeFillColor: hasError ? Colors.blueAccent : Colors.black, activeFillColor: hasError ? Colors.blueAccent : Colors.black,
), ),
cursorColor: Colors.black, cursorColor: Colors.black,
animationDuration: Duration(milliseconds: 300), animationDuration: const Duration(milliseconds: 300),
textStyle: TextStyle(fontSize: 20, height: 1.6), textStyle: const TextStyle(fontSize: 20, height: 1.6),
backgroundColor: Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
enableActiveFill: false, enableActiveFill: false,
errorAnimationController: errorController, errorAnimationController: errorController,
controller: _enterPin, controller: _enterPin,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
boxShadows: [ boxShadows: const [
BoxShadow( BoxShadow(
offset: Offset(0, 1), offset: Offset(0, 1),
color: Colors.black12, color: Colors.black12,
@ -122,7 +124,6 @@ class OnboardingStepFourteen extends StatelessWidget {
_generateWalletProvider.storeHDWChest( _generateWalletProvider.storeHDWChest(
generatedWallet, 'Mon portefeuille courant', context); generatedWallet, 'Mon portefeuille courant', context);
_myWalletProvider.readAllWallets(_currentChest); _myWalletProvider.readAllWallets(_currentChest);
_myWalletProvider.getDefaultWallet();
scheduleMicrotask(() { scheduleMicrotask(() {
_walletOptions.reloadBuild(); _walletOptions.reloadBuild();
_myWalletProvider.rebuildWidget(); _myWalletProvider.rebuildWidget();
@ -141,8 +142,8 @@ class OnboardingStepFourteen extends StatelessWidget {
} }
}, },
onChanged: (value) { onChanged: (value) {
if (pinColor != Color(0xFFA4B600)) { if (pinColor != const Color(0xFFA4B600)) {
pinColor = Color(0xFFA4B600); pinColor = const Color(0xFFA4B600);
} }
}, },
)), )),

View File

@ -1,13 +1,17 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class OnboardingStepFiveteen extends StatelessWidget { class OnboardingStepFiveteen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 12; final int progress = 12;
OnboardingStepFiveteen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -21,7 +25,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !", "Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
textKey: Key('step13'), textKey: const Key('step13'),
), ),
SizedBox(height: isTall ? 20 : 10), SizedBox(height: isTall ? 20 : 10),
Image.asset( Image.asset(
@ -35,7 +39,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goWalletHome'), key: const Key('goWalletHome'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -51,10 +55,10 @@ class OnboardingStepFiveteen extends StatelessWidget {
'/mywallets', '/mywallets',
); );
}, },
child: Text("Accéder à mes portefeuilles", child: const Text("Accéder à mes portefeuilles",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/3.dart'; import 'package:gecko/screens/onBoarding/3.dart';
// import 'package:gecko/screens/commonElements.dart'; // import 'package:gecko/screens/commonElements.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
@ -12,6 +14,8 @@ class OnboardingStepTwo extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 2; final int progress = 2;
OnboardingStepTwo({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -25,9 +29,9 @@ class OnboardingStepTwo extends StatelessWidget {
context, 'Nouveau portefeuilles', progress), context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Un trousseau est créé à partir dune phrase de restauration.", "Un trousseau est créé à partir dune phrase de restauration.",
textKey: Key('step2'), textKey: const Key('step2'),
), ),
SizedBox(height: 70), const SizedBox(height: 70),
Image.asset( Image.asset(
'assets/onBoarding/keys-and-wallets-horizontal-plus-phrase.png'), 'assets/onBoarding/keys-and-wallets-horizontal-plus-phrase.png'),
Expanded( Expanded(
@ -37,7 +41,7 @@ class OnboardingStepTwo extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep3'), key: const Key('goStep3'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -50,10 +54,11 @@ class OnboardingStepTwo extends StatelessWidget {
page: OnboardingStepFor(), isFast: true), page: OnboardingStepFor(), isFast: true),
); );
}, },
child: Text("D'accord", style: TextStyle(fontSize: 20)), child: const Text("D'accord",
style: TextStyle(fontSize: 20)),
), ),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/4.dart'; import 'package:gecko/screens/onBoarding/4.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepFor extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 3; final int progress = 3;
OnboardingStepFor({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,7 +26,7 @@ class OnboardingStepFor extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.", "Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.",
textKey: Key('step3'), textKey: const Key('step3'),
), ),
SizedBox(height: isTall ? 15 : 0), SizedBox(height: isTall ? 15 : 0),
// Row(children: <Widget>[ // Row(children: <Widget>[
@ -41,7 +45,7 @@ class OnboardingStepFor extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep4'), key: const Key('goStep4'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -54,10 +58,10 @@ class OnboardingStepFor extends StatelessWidget {
page: OnboardingStepFive(), isFast: true), page: OnboardingStepFive(), isFast: true),
); );
}, },
child: Text("J'ai compris", child: const Text("J'ai compris",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/5.dart'; import 'package:gecko/screens/onBoarding/5.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepFive extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 4; final int progress = 4;
OnboardingStepFive({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,7 +26,7 @@ class OnboardingStepFive extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Par contre, attention :\n\nDans une blockchain, il ny a pas de procédure de récupération de trousseau.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.", "Par contre, attention :\n\nDans une blockchain, il ny a pas de procédure de récupération de trousseau.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.",
textKey: Key('step4'), textKey: const Key('step4'),
), ),
SizedBox(height: isTall ? 30 : 10), SizedBox(height: isTall ? 30 : 10),
Image.asset( Image.asset(
@ -36,7 +40,7 @@ class OnboardingStepFive extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep5'), key: const Key('goStep5'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,10 +53,10 @@ class OnboardingStepFive extends StatelessWidget {
page: OnboardingStepSeven(), isFast: true), page: OnboardingStepSeven(), isFast: true),
); );
}, },
child: Text("J'ai compris", child: const Text("J'ai compris",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/6.dart'; import 'package:gecko/screens/onBoarding/6.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepSeven extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 5; final int progress = 5;
OnboardingStepSeven({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,15 +26,15 @@ class OnboardingStepSeven extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich( common.bubbleSpeakRich(
<TextSpan>[ <TextSpan>[
TextSpan(text: "Munissez-vous d'"), const TextSpan(text: "Munissez-vous d'"),
TextSpan( const TextSpan(
text: 'un papier et dun crayon\n', text: 'un papier et dun crayon\n',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan( const TextSpan(
text: text:
"afin de pouvoir noter votre phrase de restauration."), "afin de pouvoir noter votre phrase de restauration."),
], ],
textKey: Key('step5'), textKey: const Key('step5'),
), ),
Expanded( Expanded(
child: Align( child: Align(
@ -53,7 +57,7 @@ class OnboardingStepSeven extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep6'), key: const Key('goStep6'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -66,10 +70,10 @@ class OnboardingStepSeven extends StatelessWidget {
page: OnboardingStepEight(), isFast: true), page: OnboardingStepEight(), isFast: true),
); );
}, },
child: Text("J'ai de quoi noter", child: const Text("J'ai de quoi noter",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,8 +1,10 @@
// ignore_for_file: file_names
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/7.dart'; import 'package:gecko/screens/onBoarding/7.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -10,6 +12,8 @@ class OnboardingStepEight extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 6; final int progress = 6;
OnboardingStepEight({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -23,7 +27,7 @@ class OnboardingStepEight extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.", "Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.",
textKey: Key('step6'), textKey: const Key('step6'),
), ),
SizedBox(height: isTall ? 61 : 31), SizedBox(height: isTall ? 61 : 31),
// SizedBox(height: 30), // SizedBox(height: 30),
@ -36,7 +40,7 @@ class OnboardingStepEight extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep7'), key: const Key('goStep7'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,10 +53,10 @@ class OnboardingStepEight extends StatelessWidget {
page: OnboardingStepNine(), isFast: false), page: OnboardingStepNine(), isFast: false),
); );
}, },
child: Text("Afficher ma phrase", child: const Text("Afficher ma phrase",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }
@ -60,16 +64,16 @@ class OnboardingStepEight extends StatelessWidget {
Widget sentanceArray(BuildContext context) { Widget sentanceArray(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.black), border: Border.all(color: Colors.black),
color: Colors.grey[300], color: Colors.grey[300],
borderRadius: BorderRadius.all( borderRadius: const BorderRadius.all(
const Radius.circular(10), Radius.circular(10),
)), )),
// color: Colors.grey[300], // color: Colors.grey[300],
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -81,14 +85,14 @@ Widget sentanceArray(BuildContext context) {
arrayCell("3:curseur"), arrayCell("3:curseur"),
arrayCell("4:relatif"), arrayCell("4:relatif"),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell("5:embellir"), arrayCell("5:embellir"),
arrayCell("6:cultiver"), arrayCell("6:cultiver"),
arrayCell("7:bureau"), arrayCell("7:bureau"),
arrayCell("8:ossature"), arrayCell("8:ossature"),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell("9:labial"), arrayCell("9:labial"),
arrayCell("10:science"), arrayCell("10:science"),
@ -99,20 +103,20 @@ Widget sentanceArray(BuildContext context) {
} }
Widget arrayCell(dataWord) { Widget arrayCell(dataWord) {
return Container( return SizedBox(
width: 102, width: 102,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
ImageFiltered( ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 1, sigmaY: 1), imageFilter: ImageFilter.blur(sigmaX: 1, sigmaY: 1),
child: Text(dataWord.split(':')[0], child: Text(dataWord.split(':')[0],
style: TextStyle(fontSize: 14, color: Colors.black)), style: const TextStyle(fontSize: 14, color: Colors.black)),
), ),
SizedBox(height: 2), const SizedBox(height: 2),
ImageFiltered( ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4), imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
child: Text(dataWord.split(':')[1], child: Text(dataWord.split(':')[1],
style: TextStyle(fontSize: 20, color: Colors.black)), style: const TextStyle(fontSize: 20, color: Colors.black)),
) )
], ],
)); ));

View File

@ -1,8 +1,10 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/8.dart'; import 'package:gecko/screens/onBoarding/8.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -12,6 +14,8 @@ class OnboardingStepNine extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 6; final int progress = 6;
OnboardingStepNine({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -29,7 +33,7 @@ class OnboardingStepNine extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"C'est le moment de noter votre phrase !", "C'est le moment de noter votre phrase !",
textKey: Key('step7'), textKey: const Key('step7'),
long: 60, long: 60,
), ),
SizedBox(height: isTall ? 100 : 70), SizedBox(height: isTall ? 100 : 70),
@ -56,24 +60,24 @@ class OnboardingStepNine extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('generateMnemonic'), key: const Key('generateMnemonic'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffFFD58D), primary: const Color(0xffFFD58D),
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () { onPressed: () {
_generateWalletProvider.reloadBuild(); _generateWalletProvider.reloadBuild();
}, },
child: Text("Choisir une autre phrase", child: const Text("Choisir une autre phrase",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 25), const SizedBox(height: 25),
SizedBox( SizedBox(
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep8'), key: const Key('goStep8'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -97,10 +101,10 @@ class OnboardingStepNine extends StatelessWidget {
isFast: true), isFast: true),
); );
}, },
child: Text("J'ai noté ma phrase", child: const Text("J'ai noté ma phrase",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }
@ -112,7 +116,7 @@ Widget sentanceArray(BuildContext context) {
return FutureBuilder( return FutureBuilder(
future: _generateWalletProvider.generateWordList(), future: _generateWalletProvider.generateWordList(),
initialData: [ initialData: const [
'1:...', '1:...',
'2:...', '2:...',
'3:...', '3:...',
@ -129,16 +133,16 @@ Widget sentanceArray(BuildContext context) {
builder: (context, formatedArray) { builder: (context, formatedArray) {
// print(formatedArray.data); // print(formatedArray.data);
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.black), border: Border.all(color: Colors.black),
color: Colors.grey[300], color: Colors.grey[300],
borderRadius: BorderRadius.all( borderRadius: const BorderRadius.all(
const Radius.circular(10), Radius.circular(10),
)), )),
// color: Colors.grey[300], // color: Colors.grey[300],
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -150,14 +154,14 @@ Widget sentanceArray(BuildContext context) {
arrayCell(formatedArray.data[2]), arrayCell(formatedArray.data[2]),
arrayCell(formatedArray.data[3]), arrayCell(formatedArray.data[3]),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell(formatedArray.data[4]), arrayCell(formatedArray.data[4]),
arrayCell(formatedArray.data[5]), arrayCell(formatedArray.data[5]),
arrayCell(formatedArray.data[6]), arrayCell(formatedArray.data[6]),
arrayCell(formatedArray.data[7]), arrayCell(formatedArray.data[7]),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell(formatedArray.data[8]), arrayCell(formatedArray.data[8]),
arrayCell(formatedArray.data[9]), arrayCell(formatedArray.data[9]),
@ -169,20 +173,20 @@ Widget sentanceArray(BuildContext context) {
} }
Widget arrayCell(dataWord) { Widget arrayCell(dataWord) {
return Container( return SizedBox(
width: 102, width: 102,
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Text(dataWord.split(':')[0], style: TextStyle(fontSize: 14)), Text(dataWord.split(':')[0], style: const TextStyle(fontSize: 14)),
SizedBox(height: 2), const SizedBox(height: 2),
Text(dataWord.split(':')[1], Text(dataWord.split(':')[1],
key: Key('word${dataWord.split(':')[0]}'), key: Key('word${dataWord.split(':')[0]}'),
style: TextStyle(fontSize: 19, color: Colors.black)), style: const TextStyle(fontSize: 19, color: Colors.black)),
])); ]));
} }
// ignore: must_be_immutable // ignore: must_be_immutable
class PrintWallet extends StatelessWidget { class PrintWallet extends StatelessWidget {
PrintWallet(this.sentence); const PrintWallet(this.sentence, {Key key}) : super(key: key);
final String sentence; final String sentence;
@ -192,7 +196,9 @@ class PrintWallet extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
appBar: AppBar(title: Text('Imprimer ce trousseau')), appBar: AppBar(
toolbarHeight: 60 * ratio,
title: const Text('Imprimer ce trousseau')),
body: PdfPreview( body: PdfPreview(
build: (format) => _generateWalletProvider.printWallet(sentence), build: (format) => _generateWalletProvider.printWallet(sentence),
), ),

View File

@ -1,10 +1,12 @@
// ignore_for_file: file_names
import 'dart:ui'; import 'dart:ui';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/9.dart'; import 'package:gecko/screens/onBoarding/9.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -21,7 +23,7 @@ class OnboardingStepTen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
TextEditingController wordController = TextEditingController(); TextEditingController wordController = TextEditingController();
TextEditingController _mnemonicController = TextEditingController(); final TextEditingController _mnemonicController = TextEditingController();
final int progress = 7; final int progress = 7;
@ -31,7 +33,7 @@ class OnboardingStepTen extends StatelessWidget {
GenerateWalletsProvider _generateWalletProvider = GenerateWalletsProvider _generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
CommonElements common = CommonElements(); CommonElements common = CommonElements();
this._mnemonicController.text = generatedMnemonic; _mnemonicController.text = generatedMnemonic;
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
@ -60,11 +62,11 @@ class OnboardingStepTen extends StatelessWidget {
text: " de votre phrase de restauration :", text: " de votre phrase de restauration :",
style: TextStyle(fontSize: 16 * ratio)), style: TextStyle(fontSize: 16 * ratio)),
], ],
textKey: Key('step8'), textKey: const Key('step8'),
), ),
SizedBox(height: isTall ? 70 : 10), SizedBox(height: isTall ? 70 : 10),
Text('${_generateWalletProvider.nbrWord + 1}', Text('${_generateWalletProvider.nbrWord + 1}',
key: Key('askedWord'), key: const Key('askedWord'),
style: TextStyle( style: TextStyle(
fontSize: isTall ? 17 : 10, fontSize: isTall ? 17 : 10,
color: orangeC, color: orangeC,
@ -79,10 +81,10 @@ class OnboardingStepTen extends StatelessWidget {
)), )),
width: 430, width: 430,
child: TextFormField( child: TextFormField(
key: Key('inputWord'), key: const Key('inputWord'),
autofocus: true, autofocus: true,
enabled: !_generateWalletProvider.isAskedWordValid, enabled: !_generateWalletProvider.isAskedWordValid,
controller: this.wordController, controller: wordController,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
onChanged: (value) { onChanged: (value) {
_generateWalletProvider.checkAskedWord( _generateWalletProvider.checkAskedWord(
@ -100,7 +102,7 @@ class OnboardingStepTen extends StatelessWidget {
: "${_generateWalletProvider.nbrWordAlpha} mot de votre phrase de restauration", : "${_generateWalletProvider.nbrWordAlpha} mot de votre phrase de restauration",
fillColor: Colors.grey[300], fillColor: Colors.grey[300],
filled: true, filled: true,
contentPadding: EdgeInsets.all(12), contentPadding: const EdgeInsets.all(12),
), ),
style: TextStyle( style: TextStyle(
fontSize: 40.0, fontSize: 40.0,
@ -115,7 +117,7 @@ class OnboardingStepTen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep9'), key: const Key('goStep9'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -129,10 +131,10 @@ class OnboardingStepTen extends StatelessWidget {
isFast: true), isFast: true),
); );
}, },
child: Text("Continuer", child: const Text("Continuer",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
)))), )))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
))); )));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/10.dart'; import 'package:gecko/screens/onBoarding/10.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepEleven extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 8; final int progress = 8;
OnboardingStepEleven({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,15 +26,16 @@ class OnboardingStepEleven extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich( common.bubbleSpeakRich(
<TextSpan>[ <TextSpan>[
TextSpan(text: "Super !\n\nJe vais maintenant créer votre "), const TextSpan(
TextSpan( text: "Super !\n\nJe vais maintenant créer votre "),
const TextSpan(
text: 'code secret.', text: 'code secret.',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan( const TextSpan(
text: text:
" \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."), " \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."),
], ],
textKey: Key('step9'), textKey: const Key('step9'),
), ),
SizedBox(height: isTall ? 50 : 10), SizedBox(height: isTall ? 50 : 10),
Image.asset( Image.asset(
@ -44,7 +49,7 @@ class OnboardingStepEleven extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep10'), key: const Key('goStep10'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -57,10 +62,10 @@ class OnboardingStepEleven extends StatelessWidget {
page: OnboardingStepTwelve(), isFast: true), page: OnboardingStepTwelve(), isFast: true),
); );
}, },
child: Text("J'ai compris", child: const Text("J'ai compris",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/screens/myWallets/generateWallets.dart'; import 'package:gecko/screens/myWallets/generate_wallets.dart';
import 'dart:io'; import 'dart:io';
import 'package:gecko/screens/myWallets/importWallet.dart'; import 'package:gecko/screens/myWallets/import_wallet.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,7 +22,9 @@ class SettingsScreen extends StatelessWidget {
var pinColor = Colors.grey[300]; var pinColor = Colors.grey[300];
Directory appPath; Directory appPath;
MyWalletsProvider _myWallets = MyWalletsProvider(); final MyWalletsProvider _myWallets = MyWalletsProvider();
SettingsScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,12 +34,13 @@ class SettingsScreen extends StatelessWidget {
// getAppDirectory(); // getAppDirectory();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( toolbarHeight: 60 * ratio,
height: 22, title: const SizedBox(
child: Text('Paramètres'), height: 22,
)), child: Text('Paramètres'),
)),
body: Column(children: <Widget>[ body: Column(children: <Widget>[
SizedBox(height: 40), const SizedBox(height: 40),
SizedBox( SizedBox(
height: 70, height: 70,
width: 500, width: 500,
@ -50,35 +53,31 @@ class SettingsScreen extends StatelessWidget {
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return ImportWalletScreen(); return const ImportWalletScreen();
}), }),
).then((value) => { ).then((value) => {
if (value == true) {Navigator.pop(context)} if (value == true) {Navigator.pop(context)}
}), }),
child: Text("Importer un portefeuille Cesium", child: const Text("Importer un portefeuille Cesium",
style: TextStyle(fontSize: 16)))), style: TextStyle(fontSize: 16)))),
SizedBox(height: 30), const SizedBox(height: 30),
SizedBox( SizedBox(
height: 70, height: 70,
width: 500, width: 500,
child: ElevatedButton( child: ElevatedButton(
key: Key('generateKeychain'), key: const Key('generateKeychain'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: yellowC, // background primary: yellowC, // background
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: !_myWallets.checkIfWalletExist() onPressed: () => Navigator.push(
? () => Navigator.push( context,
context, MaterialPageRoute(builder: (context) {
MaterialPageRoute(builder: (context) { return GenerateFastChestScreen();
return GenerateWalletsScreen(); }),
}), ),
).then((value) => { child: const Text("Générer un nouveau trousseau",
if (value == true) {Navigator.pop(context)}
})
: null,
child: Text("Générer un nouveau trousseau",
style: TextStyle(fontSize: 16)))), style: TextStyle(fontSize: 16)))),
Expanded( Expanded(
child: Align( child: Align(
@ -87,7 +86,7 @@ class SettingsScreen extends StatelessWidget {
height: 100, height: 100,
width: 500, width: 500,
child: ElevatedButton( child: ElevatedButton(
key: Key('deleteAllWallets'), key: const Key('deleteAllWallets'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Colors.redAccent, // background primary: Colors.redAccent, // background
@ -99,9 +98,9 @@ class SettingsScreen extends StatelessWidget {
.deleteAllWallet(context) .deleteAllWallet(context)
.then((v) => _homeProvider.rebuildWidget()) .then((v) => _homeProvider.rebuildWidget())
}, },
child: Text("EFFACER TOUS MES PORTEFEUILLES", child: const Text("EFFACER TOUS MES PORTEFEUILLES",
style: TextStyle(fontSize: 20)))))), style: TextStyle(fontSize: 20)))))),
SizedBox(height: 50), const SizedBox(height: 50),
])); ]));
} }
} }

View File

@ -9,17 +9,20 @@ import 'package:flutter/material.dart';
class TemplateScreen extends StatelessWidget { class TemplateScreen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
TemplateScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context); // HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( toolbarHeight: 60 * ratio,
height: 22, title: const SizedBox(
child: Text('Template screen'), height: 22,
)), child: Text('Template screen'),
floatingActionButton: Container( )),
floatingActionButton: SizedBox(
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
child: FittedBox( child: FittedBox(
@ -28,10 +31,10 @@ class TemplateScreen extends StatelessWidget {
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return HomeScreen(); return const HomeScreen();
}), }),
), ),
child: Container( child: SizedBox(
height: 40.0, height: 40.0,
width: 40.0, width: 40.0,
child: Icon(Icons.home, color: Colors.grey[850]), child: Icon(Icons.home, color: Colors.grey[850]),
@ -41,20 +44,20 @@ class TemplateScreen extends StatelessWidget {
))), ))),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
TextField( TextField(
enabled: true, enabled: true,
controller: tplController, controller: tplController,
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
contentPadding: EdgeInsets.all(15.0), contentPadding: EdgeInsets.all(15.0),
), ),
style: TextStyle( style: const TextStyle(
fontSize: 22.0, fontSize: 22.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400)), fontWeight: FontWeight.w400)),
SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: yellowC, // background primary: yellowC, // background
@ -64,12 +67,13 @@ class TemplateScreen extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return HomeScreen(); return const HomeScreen();
}), }),
); );
}, },
child: Text('Retour Accueil', style: TextStyle(fontSize: 20))), child: const Text('Retour Accueil',
SizedBox(height: 20), style: TextStyle(fontSize: 20))),
const SizedBox(height: 20),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.popUntil( Navigator.popUntil(
@ -77,7 +81,7 @@ class TemplateScreen extends StatelessWidget {
ModalRoute.withName('/'), ModalRoute.withName('/'),
); );
}, },
child: Icon(Icons.home)) child: const Icon(Icons.home))
]), ]),
)); ));
} }

7
macos/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/
# Xcode-related
**/dgph
**/xcuserdata/

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1,24 @@
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import connectivity_plus_macos
import package_info
import package_info_plus_macos
import path_provider_macos
import printing
import sentry_flutter
import shared_preferences_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}

View File

@ -0,0 +1,572 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objects = {
/* Begin PBXAggregateTarget section */
33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
buildPhases = (
33CC111E2044C6BF0003C045 /* ShellScript */,
);
dependencies = (
);
name = "Flutter Assemble";
productName = FLX;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 33CC111A2044C6BA0003C045;
remoteInfo = FLX;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
33CC110E2044A8840003C045 /* Bundle Framework */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* gecko.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "gecko.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
33BA886A226E78AF003329D5 /* Configs */ = {
isa = PBXGroup;
children = (
33E5194F232828860026EE4D /* AppInfo.xcconfig */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
);
path = Configs;
sourceTree = "<group>";
};
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
);
sourceTree = "<group>";
};
33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup;
children = (
33CC10ED2044A3C60003C045 /* gecko.app */,
);
name = Products;
sourceTree = "<group>";
};
33CC11242044D66E0003C045 /* Resources */ = {
isa = PBXGroup;
children = (
33CC10F22044A3C60003C045 /* Assets.xcassets */,
33CC10F42044A3C60003C045 /* MainMenu.xib */,
33CC10F72044A3C60003C045 /* Info.plist */,
);
name = Resources;
path = ..;
sourceTree = "<group>";
};
33CEB47122A05771004F2AC0 /* Flutter */ = {
isa = PBXGroup;
children = (
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
);
path = Flutter;
sourceTree = "<group>";
};
33FAB671232836740065AC1E /* Runner */ = {
isa = PBXGroup;
children = (
33CC10F02044A3C60003C045 /* AppDelegate.swift */,
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
33E51913231747F40026EE4D /* DebugProfile.entitlements */,
33E51914231749380026EE4D /* Release.entitlements */,
33CC11242044D66E0003C045 /* Resources */,
33BA886A226E78AF003329D5 /* Configs */,
);
path = Runner;
sourceTree = "<group>";
};
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
33CC10EC2044A3C60003C045 /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
33CC10E92044A3C60003C045 /* Sources */,
33CC10EA2044A3C60003C045 /* Frameworks */,
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
);
buildRules = (
);
dependencies = (
33CC11202044C79F0003C045 /* PBXTargetDependency */,
);
name = Runner;
productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* gecko.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
33CC10E52044A3C60003C045 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
};
};
};
33CC111A2044C6BA0003C045 = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 33CC10E42044A3C60003C045;
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
33CC10EC2044A3C60003C045 /* Runner */,
33CC111A2044C6BA0003C045 /* Flutter Assemble */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
33CC10EB2044A3C60003C045 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
};
33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
Flutter/ephemeral/FlutterInputs.xcfilelist,
);
inputPaths = (
Flutter/ephemeral/tripwire,
);
outputFileListPaths = (
Flutter/ephemeral/FlutterOutputs.xcfilelist,
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
33CC10E92044A3C60003C045 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
33CC10F52044A3C60003C045 /* Base */,
);
name = MainMenu.xib;
path = Runner;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
338D0CE9231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Profile;
};
338D0CEA231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Profile;
};
338D0CEB231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Profile;
};
33CC10F92044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
33CC10FA2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
33CC10FC2044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
33CC10FD2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
33CC111C2044C6BA0003C045 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
33CC111D2044C6BA0003C045 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10F92044A3C60003C045 /* Debug */,
33CC10FA2044A3C60003C045 /* Release */,
338D0CE9231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10FC2044A3C60003C045 /* Debug */,
33CC10FD2044A3C60003C045 /* Release */,
338D0CEA231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC111C2044C6BA0003C045 /* Debug */,
33CC111D2044C6BA0003C045 /* Release */,
338D0CEB231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Some files were not shown because too many files have changed in this diff Show More