Improve home message style
This commit is contained in:
parent
8e49ac73ff
commit
6a57572434
|
@ -65,7 +65,7 @@ android {
|
|||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.release //poka: comment this to build unsigned release, or set to signingConfigs.debug to sign with debug keys
|
||||
signingConfig signingConfigs.debug //poka: comment this to build unsigned release, or set to signingConfigs.debug to sign with debug keys
|
||||
useProguard true
|
||||
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
|
|
|
@ -28,6 +28,7 @@ class HomeProvider with ChangeNotifier {
|
|||
Widget appBarExplorer =
|
||||
Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
|
||||
String homeMessage = "y'a pas de lézard ;-)";
|
||||
String defaultMessage = "y'a pas de lézard ;-)";
|
||||
|
||||
Future<void> initHive() async {
|
||||
late Directory hivePath;
|
||||
|
@ -74,11 +75,10 @@ class HomeProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future changeMessage(String newMessage, int seconds) async {
|
||||
final oldMessage = homeMessage;
|
||||
homeMessage = newMessage;
|
||||
notifyListeners();
|
||||
await Future.delayed(Duration(seconds: seconds));
|
||||
homeMessage = oldMessage;
|
||||
if (seconds != 0) homeMessage = defaultMessage;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ class SubstrateSdk with ChangeNotifier {
|
|||
List<NetworkParams> node = [];
|
||||
HomeProvider _homeProvider = Provider.of<HomeProvider>(ctx, listen: false);
|
||||
|
||||
_homeProvider.changeMessage("Connexion en cours...", 0);
|
||||
|
||||
for (String _endpoint in configBox.get('endpoint')) {
|
||||
final n = NetworkParams();
|
||||
n.name = currencyName;
|
||||
|
@ -98,16 +100,22 @@ class SubstrateSdk with ChangeNotifier {
|
|||
// Subscribe bloc number
|
||||
sdk.api.setting.subscribeBestNumber((res) {
|
||||
blocNumber = int.parse(res.toString());
|
||||
if (sdk.api.connectedNode?.endpoint == null) {
|
||||
_homeProvider.changeMessage("Le réseau a été perdu...", 0);
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
});
|
||||
notifyListeners();
|
||||
_homeProvider.changeMessage('Vous êtes bien connecté', 3);
|
||||
_homeProvider.changeMessage(
|
||||
'Vous êtes bien connecté aux noeud\n${getConnectedEndpoint()!.split('/')[2]}',
|
||||
5);
|
||||
// snackNode(ctx, true);
|
||||
} else {
|
||||
nodeConnected = false;
|
||||
debugConnection = res.toString();
|
||||
notifyListeners();
|
||||
_homeProvider.changeMessage("Vous n'êtes pas connecté:", 3);
|
||||
_homeProvider.changeMessage("Aucun server disponible...", 0);
|
||||
// snackNode(ctx, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef DataDidChangeCallback<T> = bool Function(T o, T n);
|
||||
|
||||
///Fades out the old data and back in with the new
|
||||
class AnimatedFadeOutIn<T> extends StatefulWidget {
|
||||
///If [initialData] is not null on first build it will be shown.
|
||||
///Directly after that the animation changes the value to [data].
|
||||
final T? initialData;
|
||||
|
||||
///The data to show
|
||||
final T data;
|
||||
final Duration duration;
|
||||
final Widget Function(T data) builder;
|
||||
final VoidCallback? onFadeComplete;
|
||||
|
||||
/// Compare the values to determine if the data has changed.
|
||||
/// If [null] the data is compared using `!=` expression
|
||||
final DataDidChangeCallback<T>? dataDidChange;
|
||||
|
||||
const AnimatedFadeOutIn({
|
||||
Key? key,
|
||||
this.initialData,
|
||||
required this.data,
|
||||
required this.builder,
|
||||
this.duration = const Duration(milliseconds: 300),
|
||||
this.onFadeComplete,
|
||||
this.dataDidChange,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AnimatedFadeOutInState<T> createState() => _AnimatedFadeOutInState<T>();
|
||||
}
|
||||
|
||||
class _AnimatedFadeOutInState<T> extends State<AnimatedFadeOutIn<T>>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController controller;
|
||||
late Animation<double> animation;
|
||||
late T dataToShow;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
dataToShow = widget.initialData ?? widget.data;
|
||||
controller = AnimationController(vsync: this, duration: widget.duration)
|
||||
..addListener(() => setState(() {}))
|
||||
..addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
dataToShow = widget.data;
|
||||
controller.reverse(from: 1.0);
|
||||
} else if (status == AnimationStatus.dismissed) {
|
||||
widget.onFadeComplete?.call();
|
||||
}
|
||||
});
|
||||
|
||||
animation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: controller,
|
||||
curve: Curves.easeIn,
|
||||
reverseCurve: Curves.easeOut,
|
||||
),
|
||||
);
|
||||
if (widget.dataDidChange?.call(dataToShow, widget.data) ??
|
||||
widget.data != dataToShow) {
|
||||
controller.forward(from: 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(AnimatedFadeOutIn<T> oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.dataDidChange?.call(oldWidget.data, widget.data) ??
|
||||
widget.data != oldWidget.data) {
|
||||
dataToShow = oldWidget.data;
|
||||
controller.forward(from: 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Opacity(
|
||||
opacity: 1.0 - animation.value,
|
||||
child: widget.builder(dataToShow),
|
||||
);
|
||||
}
|
|
@ -8,6 +8,7 @@ import 'package:gecko/providers/wallets_profiles.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/screens/animated_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
|
@ -190,29 +191,33 @@ Widget geckHome(context) {
|
|||
padding: EdgeInsets.only(top: 15 * ratio),
|
||||
child:
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||
Consumer<HomeProvider>(builder: (context, _homeP, _) {
|
||||
return Text(
|
||||
_homeP.homeMessage,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
DefaultTextStyle(
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Consumer<HomeProvider>(builder: (context, _homeP, _) {
|
||||
return AnimatedFadeOutIn<String>(
|
||||
data: _homeP.homeMessage,
|
||||
duration: const Duration(milliseconds: 100),
|
||||
builder: (value) => Text(value),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
|
|
@ -30,7 +30,7 @@ class _CustomDerivationState extends State<CustomDerivation> {
|
|||
|
||||
final derivationList = <String>[
|
||||
'root',
|
||||
for (var i = 0; i < 50; i += 1) i.toString()
|
||||
for (var i = 0; i < 51; i += 1) i.toString()
|
||||
];
|
||||
|
||||
final listWallets = _myWalletProvider.readAllWallets();
|
||||
|
|
|
@ -100,34 +100,27 @@ class WalletsHome extends StatelessWidget {
|
|||
),
|
||||
)),
|
||||
const SizedBox(height: 30),
|
||||
SizedBox(
|
||||
height: 90,
|
||||
width: 420,
|
||||
child: ElevatedButton.icon(
|
||||
icon: Image.asset(
|
||||
'assets/chests/miniChests.png',
|
||||
height: 70,
|
||||
),
|
||||
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: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0xff8a3c0f),
|
||||
),
|
||||
),
|
||||
)),
|
||||
InkWell(
|
||||
key: const Key('createNewChest'),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ChooseChest();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
height: 50,
|
||||
child: Center(
|
||||
child: Text('Changer de coffre',
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: orangeC,
|
||||
fontWeight: FontWeight.w500))),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30)
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue