fix: bad parent widget in search; improve lost connection info

This commit is contained in:
poka 2022-06-12 19:43:13 +02:00
parent 7cbf328123
commit 1a49035cbf
3 changed files with 197 additions and 182 deletions

View File

@ -121,10 +121,10 @@ class HomeScreen extends StatelessWidget {
var connectivityResult =
await (Connectivity().checkConnectivity());
if (connectivityResult != ConnectivityResult.mobile &&
connectivityResult != ConnectivityResult.wifi) {
HomeProvider _homeProvider =
Provider.of<HomeProvider>(ctx, listen: false);
if (connectivityResult != ConnectivityResult.mobile &&
connectivityResult != ConnectivityResult.wifi) {
_homeProvider.changeMessage(
"Vous n'êtes pas connecté à internet", 0);
_sub.nodeConnected = false;
@ -134,7 +134,15 @@ class HomeScreen extends StatelessWidget {
.onConnectivityChanged
.listen((ConnectivityResult result) async {
log.d('Network changed: $result');
if (result == ConnectivityResult.none) {
_sub.nodeConnected = false;
await _sub.sdk.api.setting.unsubscribeBestNumber();
_homeProvider.changeMessage(
"Vous n'êtes pas connecté à internet", 0);
_sub.reload();
} else {
await _sub.connectNode(ctx);
}
});
}
});

View File

@ -44,8 +44,8 @@ class SearchScreen extends StatelessWidget {
),
// bottomNavigationBar: _homeProvider.bottomAppBar(context),
body: SafeArea(
child: Column(children: <Widget>[
CommonElements().offlineInfo(context),
child: Stack(children: [
Column(children: <Widget>[
SizedBox(height: isTall ? 200 : 100),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 17),
@ -113,7 +113,10 @@ class SearchScreen extends StatelessWidget {
),
Spacer(flex: screenHeight <= 800 ? 1 : 2),
]),
CommonElements().offlineInfo(context),
]),
),
));
),
);
}
}

View File

@ -42,12 +42,12 @@ class SearchResultScreen extends StatelessWidget {
),
bottomNavigationBar: _homeProvider.bottomAppBar(context),
body: SafeArea(
child: Padding(
child: Stack(children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CommonElements().offlineInfo(context),
const SizedBox(height: 30),
RichText(
text: TextSpan(
@ -82,7 +82,8 @@ class SearchResultScreen extends StatelessWidget {
} else {
return Expanded(
child: ListView(children: <Widget>[
for (G1WalletsList g1Wallet in snapshot.data ?? [])
for (G1WalletsList g1Wallet
in snapshot.data ?? [])
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 5),
@ -149,7 +150,8 @@ class SearchResultScreen extends StatelessWidget {
mainAxisAlignment:
MainAxisAlignment.center,
children: [
balance(context, g1Wallet.pubkey!, 16)
balance(
context, g1Wallet.pubkey!, 16)
]),
subtitle: Row(children: <Widget>[
Text(g1Wallet.id?.username ?? '',
@ -199,6 +201,8 @@ class SearchResultScreen extends StatelessWidget {
// )
]),
),
CommonElements().offlineInfo(context),
]),
),
);
}