Move init packaging info out of multiprovider settings
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
05779c49e2
commit
66a865c0c5
|
@ -81,7 +81,7 @@ class FlwtchState extends State<Flwtch> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//appStatus = AppModel(cwtch: cwtch);
|
||||
|
||||
globalSettings.initPackageInfo();
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
getFlwtchStateProvider(),
|
||||
|
@ -91,15 +91,14 @@ class FlwtchState extends State<Flwtch> {
|
|||
getTorStatusProvider(),
|
||||
],
|
||||
builder: (context, widget) {
|
||||
Provider.of<Settings>(context).initPackageInfo();
|
||||
return Consumer<Settings>(
|
||||
builder: (context, opaque, child) => MaterialApp(
|
||||
builder: (context, settings, child) => MaterialApp(
|
||||
key: Key('app'),
|
||||
locale: Provider.of<Settings>(context).locale,
|
||||
locale: settings.locale,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
title: 'Cwtch',
|
||||
theme: mkThemeData(opaque),
|
||||
theme: mkThemeData(settings),
|
||||
// from dan: home: cwtchInit == true ? ProfileMgrView(cwtch) : SplashView(),
|
||||
// from erinn: home: columns.length == 3 ? TripleColumnView() : ProfileMgrView(),
|
||||
home: cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ProfileMgrView()) : SplashView(),
|
||||
|
|
|
@ -31,36 +31,38 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Prevents Android back button from closing the app on the profile manager screen
|
||||
// (which would shutdown connections and all kinds of other expensive to generate things)
|
||||
// TODO pop up a dialogue regarding closing the app?
|
||||
return new WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: Scaffold(
|
||||
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor(),
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.titleManageProfiles),
|
||||
actions: [
|
||||
IconButton(icon: TorIcon(), onPressed: _pushTorStatus),
|
||||
IconButton(icon: Icon(Icons.bug_report_outlined), onPressed: _setLoggingLevelDebug),
|
||||
IconButton(
|
||||
icon: Icon(Icons.lock_open),
|
||||
tooltip: AppLocalizations.of(context)!.tooltipUnlockProfiles,
|
||||
onPressed: _modalUnlockProfiles,
|
||||
),
|
||||
IconButton(icon: Icon(Icons.settings), tooltip: AppLocalizations.of(context)!.tooltipOpenSettings, onPressed: _pushGlobalSettings),
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _pushAddEditProfile,
|
||||
tooltip: AppLocalizations.of(context)!.addNewProfileBtn,
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
semanticLabel: AppLocalizations.of(context)!.addNewProfileBtn,
|
||||
return Consumer<Settings>(
|
||||
// Prevents Android back button from closing the app on the profile manager screen
|
||||
// (which would shutdown connections and all kinds of other expensive to generate things)
|
||||
// TODO pop up a dialogue regarding closing the app?
|
||||
builder: (context, settings, child) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: Scaffold(
|
||||
backgroundColor: settings.theme.backgroundMainColor(),
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.titleManageProfiles),
|
||||
actions: [
|
||||
IconButton(icon: TorIcon(), onPressed: _pushTorStatus),
|
||||
IconButton(icon: Icon(Icons.bug_report_outlined), onPressed: _setLoggingLevelDebug),
|
||||
IconButton(
|
||||
icon: Icon(Icons.lock_open),
|
||||
tooltip: AppLocalizations.of(context)!.tooltipUnlockProfiles,
|
||||
onPressed: _modalUnlockProfiles,
|
||||
),
|
||||
IconButton(icon: Icon(Icons.settings), tooltip: AppLocalizations.of(context)!.tooltipOpenSettings, onPressed: _pushGlobalSettings),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: _buildProfileManager(), //_buildSuggestions(),
|
||||
));
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _pushAddEditProfile,
|
||||
tooltip: AppLocalizations.of(context)!.addNewProfileBtn,
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
semanticLabel: AppLocalizations.of(context)!.addNewProfileBtn,
|
||||
),
|
||||
),
|
||||
body: _buildProfileManager(),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
void _setLoggingLevelDebug() {
|
||||
|
@ -154,28 +156,32 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
|
|||
}
|
||||
|
||||
Widget _buildProfileManager() {
|
||||
final tiles = Provider.of<ProfileListState>(context).profiles.map(
|
||||
(ProfileInfoState profile) {
|
||||
return ChangeNotifierProvider<ProfileInfoState>.value(
|
||||
value: profile,
|
||||
builder: (context, child) => RepaintBoundary(child: ProfileRow()),
|
||||
return Consumer<ProfileListState>(
|
||||
builder: (context, pls, child) {
|
||||
final tiles = pls.profiles.map(
|
||||
(ProfileInfoState profile) {
|
||||
return ChangeNotifierProvider<ProfileInfoState>.value(
|
||||
value: profile,
|
||||
builder: (context, child) => RepaintBoundary(child: ProfileRow()),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final divided = ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: tiles,
|
||||
).toList();
|
||||
|
||||
if (tiles.isEmpty) {
|
||||
return const Center(
|
||||
child: const Text(
|
||||
"Please create or unlock a profile to begin!",
|
||||
textAlign: TextAlign.center,
|
||||
));
|
||||
}
|
||||
|
||||
return ListView(children: divided);
|
||||
},
|
||||
);
|
||||
|
||||
final divided = ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: tiles,
|
||||
).toList();
|
||||
|
||||
if (tiles.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Please create or unlock a profile to begin!",
|
||||
textAlign: TextAlign.center,
|
||||
));
|
||||
}
|
||||
|
||||
return ListView(children: divided);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,8 @@ import 'package:flutter/material.dart';
|
|||
class SplashView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("SplashView build()");
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text("Cwtch")),
|
||||
body: Center(child: Column(children: <Widget>[Text("Loading Cwtch...")])),
|
||||
return const Scaffold(
|
||||
body: const Center(child: const Text("Loading Cwtch...")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue