Fix Snack display
This commit is contained in:
parent
b3cd00749d
commit
3b915be9d3
|
@ -162,24 +162,27 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
|
||||
// Build history list
|
||||
return NotificationListener(
|
||||
child: Expanded(
|
||||
child: Builder(
|
||||
builder: (context) => Expanded(
|
||||
child: ListView(
|
||||
controller: scrollController,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20),
|
||||
if (_historyProvider.pubkey != '')
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (_isFirstExec)
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.fromLTRB(12, 0, 5, 0),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
12, 0, 5, 0),
|
||||
child: FutureBuilder(
|
||||
future: _cesiumPlusProvider
|
||||
.getAvatar(_historyProvider.pubkey),
|
||||
future:
|
||||
_cesiumPlusProvider.getAvatar(
|
||||
_historyProvider.pubkey),
|
||||
initialData: [
|
||||
File(appPath.path +
|
||||
'/default_avatar.png')
|
||||
|
@ -203,8 +206,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
}
|
||||
if (_avatar.hasData) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: Image.file(_avatar.data[0],
|
||||
padding:
|
||||
EdgeInsets.all(0.0),
|
||||
child: Image.file(
|
||||
_avatar.data[0],
|
||||
height: avatarsSize));
|
||||
}
|
||||
return Image.file(
|
||||
|
@ -219,8 +224,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
_historyProvider.snackCopyKey(context);
|
||||
},
|
||||
child: Text(
|
||||
_historyProvider
|
||||
.getShortPubkey(_historyProvider.pubkey),
|
||||
_historyProvider.getShortPubkey(
|
||||
_historyProvider.pubkey),
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w800,
|
||||
|
@ -234,28 +239,32 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
]),
|
||||
if (_isFirstExec)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
0, 0, 0, 0),
|
||||
// padding: const EdgeInsets.,
|
||||
child: FutureBuilder(
|
||||
future: _cesiumPlusProvider
|
||||
.getName(_historyProvider.pubkey),
|
||||
future: _cesiumPlusProvider.getName(
|
||||
_historyProvider.pubkey),
|
||||
initialData: '...',
|
||||
builder: (context, snapshot) {
|
||||
return Text(
|
||||
snapshot.data != ''
|
||||
? snapshot.data
|
||||
: '-',
|
||||
style: TextStyle(fontSize: 20));
|
||||
style:
|
||||
TextStyle(fontSize: 20));
|
||||
}))
|
||||
]),
|
||||
SizedBox(height: 18),
|
||||
if (_isFirstExec)
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||
padding:
|
||||
const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||
child: Text(balance.toString() + ' Ğ1',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 18.0))),
|
||||
|
@ -269,9 +278,11 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
onPressed: () {
|
||||
_historyProvider.switchProfileView();
|
||||
},
|
||||
child: Text(_historyProvider.historySwitchButtun,
|
||||
child: Text(
|
||||
_historyProvider.historySwitchButtun,
|
||||
style: TextStyle(
|
||||
fontSize: 15, color: Color(0xffD28928)))),
|
||||
fontSize: 15,
|
||||
color: Color(0xffD28928)))),
|
||||
// const Divider(
|
||||
// color: Colors.grey,
|
||||
// height: 5,
|
||||
|
@ -283,7 +294,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
? historyView(context, result)
|
||||
: payView(context),
|
||||
],
|
||||
)),
|
||||
))),
|
||||
onNotification: (t) {
|
||||
if (t is ScrollEndNotification &&
|
||||
scrollController.position.pixels >=
|
||||
|
|
|
@ -12,8 +12,7 @@ class HomeScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||
// _historyProvider.snackNode(context);
|
||||
|
||||
HistoryProvider _historyStatic = HistoryProvider('');
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
drawer: Drawer(
|
||||
|
@ -74,13 +73,6 @@ class HomeScreen extends StatelessWidget {
|
|||
icon: _homeProvider.searchIcon,
|
||||
color: Colors.grey[850],
|
||||
onPressed: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) {
|
||||
// return SearchList();
|
||||
// }),
|
||||
// );
|
||||
|
||||
if (_homeProvider.searchIcon.icon == Icons.search) {
|
||||
_homeProvider.searchIcon = Icon(
|
||||
Icons.close,
|
||||
|
@ -115,12 +107,14 @@ class HomeScreen extends StatelessWidget {
|
|||
backgroundColor: Color(0xffFFD58D),
|
||||
),
|
||||
backgroundColor: Color(0xffF9F9F1),
|
||||
body: // _homeProvider.currentTab[_homeProvider.currentIndex],
|
||||
Builder(
|
||||
builder: (context) => Column(children: <Widget>[
|
||||
// _historyProvider.snackNode(context),
|
||||
// SnackBar(content: Text('tataaa')),
|
||||
|
||||
body: Builder(
|
||||
builder: (ctx) => StatefulWrapper(
|
||||
onInit: () {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_historyStatic.snackNode(ctx);
|
||||
});
|
||||
},
|
||||
child: Column(children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 22),
|
||||
child: Row(
|
||||
|
@ -128,7 +122,8 @@ class HomeScreen extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
SizedBox(width: 7),
|
||||
Image(
|
||||
image: AssetImage('assets/icon/gecko_final.png'),
|
||||
image:
|
||||
AssetImage('assets/icon/gecko_final.png'),
|
||||
height: 180),
|
||||
])),
|
||||
Padding(
|
||||
|
@ -139,7 +134,8 @@ class HomeScreen extends StatelessWidget {
|
|||
Text(
|
||||
"L’application de paiement Ğ1\nplus mobile qu’un lésard du Vietnam",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 15),
|
||||
)
|
||||
])),
|
||||
Padding(
|
||||
|
@ -153,8 +149,8 @@ class HomeScreen extends StatelessWidget {
|
|||
child: Material(
|
||||
color: Color(0xffFFD58D), // button color
|
||||
child: InkWell(
|
||||
splashColor:
|
||||
Color(0xffD28928), // inkwell color
|
||||
splashColor: Color(
|
||||
0xffD28928), // inkwell color
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(17),
|
||||
child: Image(
|
||||
|
@ -162,7 +158,8 @@ class HomeScreen extends StatelessWidget {
|
|||
'assets/qrcode-scan.png'),
|
||||
height: 58)),
|
||||
onTap: () async {
|
||||
await _historyProvider.scan(context);
|
||||
await _historyProvider
|
||||
.scan(context);
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
@ -182,28 +179,30 @@ class HomeScreen extends StatelessWidget {
|
|||
Text(
|
||||
"Payer par QR-Code",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.black, fontSize: 13),
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 13),
|
||||
)
|
||||
])
|
||||
])),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 60),
|
||||
child:
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: <
|
||||
Widget>[
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Column(children: <Widget>[
|
||||
Container(
|
||||
child: ClipOval(
|
||||
child: Material(
|
||||
color: Color(0xffFFD58D), // button color
|
||||
child: InkWell(
|
||||
splashColor: Color(0xffD28928), // inkwell color
|
||||
splashColor: Color(
|
||||
0xffD28928), // inkwell color
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 18, vertical: 14),
|
||||
child: Image(
|
||||
image:
|
||||
AssetImage('assets/blockchain.png'),
|
||||
image: AssetImage(
|
||||
'assets/blockchain.png'),
|
||||
height: 65)),
|
||||
onTap: () {}),
|
||||
),
|
||||
|
@ -224,7 +223,8 @@ class HomeScreen extends StatelessWidget {
|
|||
Text(
|
||||
"Explorer\n",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.black, fontSize: 13),
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 13),
|
||||
)
|
||||
]),
|
||||
SizedBox(width: 140),
|
||||
|
@ -234,16 +234,19 @@ class HomeScreen extends StatelessWidget {
|
|||
child: Material(
|
||||
color: Color(0xffFFD58D), // button color
|
||||
child: InkWell(
|
||||
splashColor: Color(0xffD28928), // inkwell color
|
||||
splashColor: Color(
|
||||
0xffD28928), // inkwell color
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Image(
|
||||
image: AssetImage('assets/lock.png'),
|
||||
image: AssetImage(
|
||||
'assets/lock.png'),
|
||||
height: 50)),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return WalletsHome();
|
||||
}),
|
||||
);
|
||||
|
@ -266,7 +269,8 @@ class HomeScreen extends StatelessWidget {
|
|||
Text(
|
||||
"Gérer mes\nportefeuilles",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.black, fontSize: 13),
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 13),
|
||||
)
|
||||
])
|
||||
]))
|
||||
|
@ -292,6 +296,29 @@ class HomeScreen extends StatelessWidget {
|
|||
// ),
|
||||
// ],
|
||||
// ),
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
class StatefulWrapper extends StatefulWidget {
|
||||
final Function onInit;
|
||||
final Widget child;
|
||||
const StatefulWrapper({@required this.onInit, @required this.child});
|
||||
@override
|
||||
_StatefulWrapperState createState() => _StatefulWrapperState();
|
||||
}
|
||||
|
||||
class _StatefulWrapperState extends State<StatefulWrapper> {
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.onInit != null) {
|
||||
widget.onInit();
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return widget.child;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue