fix: bad parent widget in search; improve lost connection info
This commit is contained in:
parent
7cbf328123
commit
1a49035cbf
|
@ -121,10 +121,10 @@ class HomeScreen extends StatelessWidget {
|
||||||
|
|
||||||
var connectivityResult =
|
var connectivityResult =
|
||||||
await (Connectivity().checkConnectivity());
|
await (Connectivity().checkConnectivity());
|
||||||
|
HomeProvider _homeProvider =
|
||||||
|
Provider.of<HomeProvider>(ctx, listen: false);
|
||||||
if (connectivityResult != ConnectivityResult.mobile &&
|
if (connectivityResult != ConnectivityResult.mobile &&
|
||||||
connectivityResult != ConnectivityResult.wifi) {
|
connectivityResult != ConnectivityResult.wifi) {
|
||||||
HomeProvider _homeProvider =
|
|
||||||
Provider.of<HomeProvider>(ctx, listen: false);
|
|
||||||
_homeProvider.changeMessage(
|
_homeProvider.changeMessage(
|
||||||
"Vous n'êtes pas connecté à internet", 0);
|
"Vous n'êtes pas connecté à internet", 0);
|
||||||
_sub.nodeConnected = false;
|
_sub.nodeConnected = false;
|
||||||
|
@ -134,7 +134,15 @@ class HomeScreen extends StatelessWidget {
|
||||||
.onConnectivityChanged
|
.onConnectivityChanged
|
||||||
.listen((ConnectivityResult result) async {
|
.listen((ConnectivityResult result) async {
|
||||||
log.d('Network changed: $result');
|
log.d('Network changed: $result');
|
||||||
await _sub.connectNode(ctx);
|
if (result == ConnectivityResult.none) {
|
||||||
|
_sub.nodeConnected = false;
|
||||||
|
await _sub.sdk.api.setting.unsubscribeBestNumber();
|
||||||
|
_homeProvider.changeMessage(
|
||||||
|
"Vous n'êtes pas connecté à internet", 0);
|
||||||
|
_sub.reload();
|
||||||
|
} else {
|
||||||
|
await _sub.connectNode(ctx);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,31 +21,31 @@ class SearchScreen extends StatelessWidget {
|
||||||
// Provider.of<HomeProvider>(context, listen: false);
|
// Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_searchProvider.searchController.text = '';
|
_searchProvider.searchController.text = '';
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text('Rechercher'),
|
child: Text('Rechercher'),
|
||||||
),
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
|
||||||
onPressed: () {
|
|
||||||
_searchProvider.searchController.text = '';
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
// bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
leading: IconButton(
|
||||||
body: SafeArea(
|
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||||
child: Column(children: <Widget>[
|
onPressed: () {
|
||||||
CommonElements().offlineInfo(context),
|
_searchProvider.searchController.text = '';
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
// bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Stack(children: [
|
||||||
|
Column(children: <Widget>[
|
||||||
SizedBox(height: isTall ? 200 : 100),
|
SizedBox(height: isTall ? 200 : 100),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||||
|
@ -113,7 +113,10 @@ class SearchScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Spacer(flex: screenHeight <= 800 ? 1 : 2),
|
Spacer(flex: screenHeight <= 800 ? 1 : 2),
|
||||||
]),
|
]),
|
||||||
),
|
CommonElements().offlineInfo(context),
|
||||||
));
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,163 +42,167 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: Stack(children: [
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
CommonElements().offlineInfo(context),
|
children: <Widget>[
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
color: Colors.grey[700],
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
const TextSpan(
|
||||||
|
text: "Résultats pour ",
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: '"${_searchProvider.searchController.text}"',
|
||||||
|
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
children: <TextSpan>[
|
|
||||||
const TextSpan(
|
|
||||||
text: "Résultats pour ",
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: '"${_searchProvider.searchController.text}"',
|
|
||||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 40),
|
||||||
const SizedBox(height: 40),
|
Text(
|
||||||
Text(
|
'Dans la blockchain $currencyName',
|
||||||
'Dans la blockchain $currencyName',
|
style: const TextStyle(fontSize: 20),
|
||||||
style: const TextStyle(fontSize: 20),
|
),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
const SizedBox(height: 20),
|
FutureBuilder(
|
||||||
FutureBuilder(
|
future: _searchProvider.searchAddress(),
|
||||||
future: _searchProvider.searchAddress(),
|
builder: (context, AsyncSnapshot<List?> snapshot) {
|
||||||
builder: (context, AsyncSnapshot<List?> snapshot) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
log.d(snapshot.data);
|
||||||
log.d(snapshot.data);
|
if (snapshot.data?.isEmpty ?? true) {
|
||||||
if (snapshot.data?.isEmpty ?? true) {
|
return const Text('Aucun résultat');
|
||||||
return const Text('Aucun résultat');
|
} else {
|
||||||
} else {
|
return Expanded(
|
||||||
return Expanded(
|
child: ListView(children: <Widget>[
|
||||||
child: ListView(children: <Widget>[
|
for (G1WalletsList g1Wallet
|
||||||
for (G1WalletsList g1Wallet in snapshot.data ?? [])
|
in snapshot.data ?? [])
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 5),
|
const EdgeInsets.symmetric(horizontal: 5),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
key: Key('searchResult${keyID++}'),
|
key: Key('searchResult${keyID++}'),
|
||||||
horizontalTitleGap: 40,
|
horizontalTitleGap: 40,
|
||||||
contentPadding: const EdgeInsets.all(5),
|
contentPadding: const EdgeInsets.all(5),
|
||||||
leading:
|
leading:
|
||||||
// g1WalletsBox.get(g1Wallet.pubkey)
|
// g1WalletsBox.get(g1Wallet.pubkey)
|
||||||
// ?.avatar !=
|
// ?.avatar !=
|
||||||
// null
|
// null
|
||||||
// ?
|
// ?
|
||||||
_cesiumPlusProvider
|
_cesiumPlusProvider
|
||||||
.defaultAvatar(_avatarSize),
|
.defaultAvatar(_avatarSize),
|
||||||
// : FutureBuilder(
|
// : FutureBuilder(
|
||||||
// future: _cesiumPlusProvider.getAvatar(
|
// future: _cesiumPlusProvider.getAvatar(
|
||||||
// g1Wallet.pubkey, _avatarSize),
|
// g1Wallet.pubkey, _avatarSize),
|
||||||
// builder: (BuildContext context,
|
// builder: (BuildContext context,
|
||||||
// AsyncSnapshot<Image?> _avatar) {
|
// AsyncSnapshot<Image?> _avatar) {
|
||||||
// if (_avatar.connectionState !=
|
// if (_avatar.connectionState !=
|
||||||
// ConnectionState.done ||
|
// ConnectionState.done ||
|
||||||
// _avatar.hasError) {
|
// _avatar.hasError) {
|
||||||
// return Stack(children: [
|
// return Stack(children: [
|
||||||
// _cesiumPlusProvider
|
// _cesiumPlusProvider
|
||||||
// .defaultAvatar(_avatarSize),
|
// .defaultAvatar(_avatarSize),
|
||||||
// Positioned(
|
// Positioned(
|
||||||
// top: 8,
|
// top: 8,
|
||||||
// right: 0,
|
// right: 0,
|
||||||
// width: 12,
|
// width: 12,
|
||||||
// height: 12,
|
// height: 12,
|
||||||
// child: CircularProgressIndicator(
|
// child: CircularProgressIndicator(
|
||||||
// strokeWidth: 1,
|
// strokeWidth: 1,
|
||||||
// color: orangeC,
|
// color: orangeC,
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
// if (_avatar.hasData) {
|
// if (_avatar.hasData) {
|
||||||
// final _w =
|
// final _w =
|
||||||
// g1WalletsBox.get(g1Wallet.pubkey);
|
// g1WalletsBox.get(g1Wallet.pubkey);
|
||||||
// if (_w != null) {
|
// if (_w != null) {
|
||||||
// _w.avatar = _avatar.data;
|
// _w.avatar = _avatar.data;
|
||||||
// }
|
// }
|
||||||
// return ClipOval(child: _avatar.data);
|
// return ClipOval(child: _avatar.data);
|
||||||
// } else {
|
// } else {
|
||||||
// g1WalletsBox
|
// g1WalletsBox
|
||||||
// .get(g1Wallet.pubkey)!
|
// .get(g1Wallet.pubkey)!
|
||||||
// .avatar =
|
// .avatar =
|
||||||
// _cesiumPlusProvider
|
// _cesiumPlusProvider
|
||||||
// .defaultAvatar(_avatarSize);
|
// .defaultAvatar(_avatarSize);
|
||||||
// return _cesiumPlusProvider
|
// return _cesiumPlusProvider
|
||||||
// .defaultAvatar(_avatarSize);
|
// .defaultAvatar(_avatarSize);
|
||||||
// }
|
// }
|
||||||
// }),
|
// }),
|
||||||
title: Row(children: <Widget>[
|
title: Row(children: <Widget>[
|
||||||
Text(getShortPubkey(g1Wallet.pubkey!),
|
Text(getShortPubkey(g1Wallet.pubkey!),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontFamily: 'Monospace',
|
fontFamily: 'Monospace',
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
textAlign: TextAlign.center),
|
textAlign: TextAlign.center),
|
||||||
]),
|
]),
|
||||||
trailing: Column(
|
trailing: Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
balance(context, g1Wallet.pubkey!, 16)
|
balance(
|
||||||
]),
|
context, g1Wallet.pubkey!, 16)
|
||||||
subtitle: Row(children: <Widget>[
|
]),
|
||||||
Text(g1Wallet.id?.username ?? '',
|
subtitle: Row(children: <Widget>[
|
||||||
style: const TextStyle(
|
Text(g1Wallet.id?.username ?? '',
|
||||||
fontSize: 18,
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w500),
|
fontSize: 18,
|
||||||
textAlign: TextAlign.center),
|
fontWeight: FontWeight.w500),
|
||||||
]),
|
textAlign: TextAlign.center),
|
||||||
dense: false,
|
]),
|
||||||
isThreeLine: false,
|
dense: false,
|
||||||
onTap: () {
|
isThreeLine: false,
|
||||||
Navigator.push(
|
onTap: () {
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(builder: (context) {
|
context,
|
||||||
_walletsProfilesClass.address =
|
MaterialPageRoute(builder: (context) {
|
||||||
g1Wallet.pubkey;
|
_walletsProfilesClass.address =
|
||||||
return WalletViewScreen(
|
g1Wallet.pubkey;
|
||||||
pubkey: g1Wallet.pubkey,
|
return WalletViewScreen(
|
||||||
username: g1WalletsBox
|
pubkey: g1Wallet.pubkey,
|
||||||
.get(g1Wallet.pubkey)
|
username: g1WalletsBox
|
||||||
?.id
|
.get(g1Wallet.pubkey)
|
||||||
?.username,
|
?.id
|
||||||
avatar: g1WalletsBox
|
?.username,
|
||||||
.get(g1Wallet.pubkey)
|
avatar: g1WalletsBox
|
||||||
?.avatar,
|
.get(g1Wallet.pubkey)
|
||||||
);
|
?.avatar,
|
||||||
}),
|
);
|
||||||
);
|
}),
|
||||||
}),
|
);
|
||||||
),
|
}),
|
||||||
]),
|
),
|
||||||
);
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return Center(
|
||||||
return Center(
|
heightFactor: 5,
|
||||||
heightFactor: 5,
|
child: CircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
strokeWidth: 3,
|
||||||
strokeWidth: 3,
|
backgroundColor: yellowC,
|
||||||
backgroundColor: yellowC,
|
color: orangeC,
|
||||||
color: orangeC,
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
// Text(
|
||||||
// Text(
|
// _searchProvider.searchResult.toString(),
|
||||||
// _searchProvider.searchResult.toString(),
|
// )
|
||||||
// )
|
]),
|
||||||
]),
|
),
|
||||||
),
|
CommonElements().offlineInfo(context),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue