Updated README, minor async fix in main.dart
This commit is contained in:
parent
996c294153
commit
44c964b889
15
README.md
15
README.md
@ -1,16 +1,3 @@
|
||||
# pogdark
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
This is pogdark
|
@ -32,15 +32,18 @@ class MyAppState extends State<MyApp> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_prefsReady =
|
||||
Provider.of<SharedPreferencesProvider>(context, listen: false).ready;
|
||||
|
||||
// Retrieve SharedPreferencesProvider instance outside async function
|
||||
final prefsProvider =
|
||||
Provider.of<SharedPreferencesProvider>(context, listen: false);
|
||||
_prefsReady = prefsProvider.ready;
|
||||
|
||||
_prefsReady!.then((_) {
|
||||
final prefsProvider =
|
||||
Provider.of<SharedPreferencesProvider>(context, listen: false);
|
||||
// Check if username is not set; if so, show ProfileScreen initially
|
||||
if (prefsProvider.getUserName().isEmpty) {
|
||||
// Ensure the widget is still mounted before updating state
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
showProfileInitially = true;
|
||||
// Check if the username is not set, then show ProfileScreen initially
|
||||
showProfileInitially = prefsProvider.getUserName().isEmpty;
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -89,8 +92,7 @@ class MyAppState extends State<MyApp> {
|
||||
child: Center(
|
||||
child: ProfileScreen(
|
||||
isEditing: false,
|
||||
onClose:
|
||||
closeInitialProfileScreen, // Close after setup
|
||||
onClose: closeInitialProfileScreen,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -103,7 +105,7 @@ class MyAppState extends State<MyApp> {
|
||||
child: Center(
|
||||
child: ProfileScreen(
|
||||
isEditing: true,
|
||||
onClose: toggleProfileScreen, // Toggle on edit
|
||||
onClose: toggleProfileScreen,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user