Skip to content

Commit c07eb4e

Browse files
fix error handling and UI inconsistencies
1 parent f1f57cd commit c07eb4e

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/routes/docs/tutorials/flutter/step-4/+page.markdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class _LoginState extends State<Login> {
231231
_passwordController.text,
232232
);
233233
} catch (e) {
234+
if (!mounted) return;
234235
ScaffoldMessenger.of(context).showSnackBar(
235236
SnackBar(content: Text(e.toString())),
236237
);

src/routes/docs/tutorials/flutter/step-6/+page.markdoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To store your ideas, you need to create a database first.
1515
3. Give it a name and ID. For this tutorial, we'll use `Ideas Tracker` as the name and `default` as the ID.
1616
4. You'll need to remember the database ID as you'll need it later.
1717

18-
# Create table {% #create-table %}
18+
## Create table {% #create-table %}
1919
In Appwrite, data is stored as a table of rows. Create a table in the [Appwrite Console](https://cloud.appwrite.io/) to store our ideas.
2020
Make sure to the remember the table ID, for this tutorial, we'll use `ideas_tracker` as the table ID.
2121

@@ -116,7 +116,6 @@ class IdeasProvider extends ChangeNotifier {
116116

117117
_ideas.removeWhere((item) => item.$id == id);
118118
notifyListeners();
119-
await init();
120119
debugPrint('Idea removed');
121120
} catch (e) {
122121
rethrow;

src/routes/docs/tutorials/flutter/step-7/+page.markdoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,18 @@ class _HomeState extends State<Home> {
132132

133133
const SizedBox(height: 8),
134134
ElevatedButton(
135-
onPressed: () => isOwner? ideasProvider.remove(idea.$id) : null,
135+
onPressed: () async {
136+
if (isOwner) {
137+
try {
138+
await ideasProvider.remove(idea.$id);
139+
} catch (e) {
140+
if (!mounted) return;
141+
ScaffoldMessenger.of(context).showSnackBar(
142+
SnackBar(content: Text(e.toString())),
143+
);
144+
}
145+
}
146+
},
136147
style: isOwner ? Styles.button : Styles.disabledButton,
137148
child: const Text(
138149
"Remove",

0 commit comments

Comments
 (0)