updated url recipe page

This commit is contained in:
broodjeaap89 2021-09-13 21:43:27 +02:00
parent a82ad9f375
commit 8cdfed1946
2 changed files with 41 additions and 37 deletions

View file

@ -34,46 +34,51 @@ class AddRecipeURLPageState extends State<AddRecipeURLPage> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 5, flex: 5,
child: InkWell( child: Container(
onTap: () async { color: Colors.blue,
showDialog(context: context, builder: (BuildContext context) { width: double.infinity,
return AlertDialog( child: TextButton(
title: const Text("URL"), onPressed: () async {
content: TextFormField( showDialog(context: context, builder: (BuildContext context) {
decoration: const InputDecoration( return AlertDialog(
hintText: "Recipe URL", title: const Text("URL"),
), content: TextFormField(
initialValue: url ?? "", decoration: const InputDecoration(
onChanged: (String newUrl) { hintText: "Recipe URL",
setState(() { ),
tempUrl = newUrl; initialValue: url ?? "",
}); onChanged: (String newUrl) {
},
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("Cancel"),
),
TextButton(
onPressed: () {
Navigator.pop(context);
url = tempUrl;
setState(() { setState(() {
fetchUrl(); tempUrl = newUrl;
}); });
}, },
child: const Text("Fetch"),
), ),
], actions: <Widget>[
); TextButton(
}); onPressed: () {
}, Navigator.pop(context);
child: Text(url ?? "?"), },
), child: const Text("Cancel"),
),
TextButton(
onPressed: () {
Navigator.pop(context);
url = tempUrl;
setState(() {
fetchUrl();
});
},
child: const Text("Fetch"),
),
],
);
});
},
child: Text(url ?? "Tap to load URL", style: const TextStyle(color: Colors.white)),
),
),
), ),
const Divider(),
Expanded( Expanded(
flex: 45, flex: 45,
child: ListView( child: ListView(

View file

@ -13,8 +13,7 @@
- RecipeStep.waitUnit should probably be an enum? - RecipeStep.waitUnit should probably be an enum?
- refactor to const page names instead of loose strings everywhere ('/path/page') - refactor to const page names instead of loose strings everywhere ('/path/page')
- also do this with hive box names - also do this with hive box names
- make the url fetching less shit - probably use a stream for adding fetched url data to the listview ?
- probably use a stream for adding to the listview ?
## Bug ## Bug
- add option to start recipe step instruction after step datetime and not completed - add option to start recipe step instruction after step datetime and not completed