added initial url to github pizza recipe repo and fixed a but with filling in the url
This commit is contained in:
parent
a0c0e02035
commit
3296f8a415
1 changed files with 4 additions and 3 deletions
|
@ -12,6 +12,7 @@ import 'package:yaml/yaml.dart';
|
||||||
class AddRecipeURLPage extends StatefulWidget {
|
class AddRecipeURLPage extends StatefulWidget {
|
||||||
static const String route = "/recipes/add/url";
|
static const String route = "/recipes/add/url";
|
||||||
final String? url;
|
final String? url;
|
||||||
|
static const String initialUrl = "https://raw.githubusercontent.com/broodjeaap/PizzaRecipes/master/index.yaml";
|
||||||
|
|
||||||
const AddRecipeURLPage(this.url);
|
const AddRecipeURLPage(this.url);
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ class AddRecipeURLPage extends StatefulWidget {
|
||||||
|
|
||||||
class AddRecipeURLPageState extends State<AddRecipeURLPage> {
|
class AddRecipeURLPageState extends State<AddRecipeURLPage> {
|
||||||
String? url;
|
String? url;
|
||||||
String tempUrl = "?";
|
late String tempUrl;
|
||||||
final ValueNotifier<List<Widget>> itemListNotifier = ValueNotifier(<Widget>[]);
|
final ValueNotifier<List<Widget>> itemListNotifier = ValueNotifier(<Widget>[]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -31,7 +32,7 @@ class AddRecipeURLPageState extends State<AddRecipeURLPage> {
|
||||||
if (url != null){
|
if (url != null){
|
||||||
fetchUrl(url!).then((widgets) => itemListNotifier.value = widgets);
|
fetchUrl(url!).then((widgets) => itemListNotifier.value = widgets);
|
||||||
}
|
}
|
||||||
|
tempUrl = url ?? AddRecipeURLPage.initialUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -55,7 +56,7 @@ class AddRecipeURLPageState extends State<AddRecipeURLPage> {
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
hintText: "Recipe URL",
|
hintText: "Recipe URL",
|
||||||
),
|
),
|
||||||
initialValue: url ?? "",
|
initialValue: url ?? AddRecipeURLPage.initialUrl,
|
||||||
onChanged: (String newUrl) {
|
onChanged: (String newUrl) {
|
||||||
tempUrl = newUrl;
|
tempUrl = newUrl;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue