From f60e9d2ae4d2fcabce518f709d984c72a6d55e6c Mon Sep 17 00:00:00 2001 From: woshikie Date: Sat, 8 Aug 2020 17:34:59 +0800 Subject: [PATCH] typo fixes --- lib/classes/api/poe_compact_stash.dart | 6 +++--- lib/classes/api/poe_compact_stash.g.dart | 4 ++-- lib/components/option_row_text_form_field.dart | 2 +- lib/views/setting.dart | 11 +++++++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/classes/api/poe_compact_stash.dart b/lib/classes/api/poe_compact_stash.dart index 1c277ce..5fb7e9b 100644 --- a/lib/classes/api/poe_compact_stash.dart +++ b/lib/classes/api/poe_compact_stash.dart @@ -14,10 +14,10 @@ class PoeCompactStash { final int index; @JsonKey(fromJson: _colorFromJson, toJson: _colorToJson) - final Color color; + final Color colour; static Color _colorFromJson(dynamic json) { - return Color.fromARGB(255, json.r, json.g, json.b); + return Color.fromARGB(255, json['r'], json['g'], json['b']); } static Map _colorToJson(Color color) { @@ -28,7 +28,7 @@ class PoeCompactStash { }; } - PoeCompactStash(this.n, this.id, this.index, this.color); + PoeCompactStash(this.n, this.id, this.index, this.colour); factory PoeCompactStash.fromJson(Map json) => _$PoeCompactStashFromJson(json); Map toJson() => _$PoeCompactStashToJson(this); diff --git a/lib/classes/api/poe_compact_stash.g.dart b/lib/classes/api/poe_compact_stash.g.dart index d42a4ea..d450b48 100644 --- a/lib/classes/api/poe_compact_stash.g.dart +++ b/lib/classes/api/poe_compact_stash.g.dart @@ -11,7 +11,7 @@ PoeCompactStash _$PoeCompactStashFromJson(Map json) { json['n'] as String, json['id'] as String, json['i'] as int, - PoeCompactStash._colorFromJson(json['color']), + PoeCompactStash._colorFromJson(json['colour']), ); } @@ -20,5 +20,5 @@ Map _$PoeCompactStashToJson(PoeCompactStash instance) => 'n': instance.n, 'id': instance.id, 'i': instance.index, - 'color': PoeCompactStash._colorToJson(instance.color), + 'colour': PoeCompactStash._colorToJson(instance.colour), }; diff --git a/lib/components/option_row_text_form_field.dart b/lib/components/option_row_text_form_field.dart index 1df44d9..93639b8 100644 --- a/lib/components/option_row_text_form_field.dart +++ b/lib/components/option_row_text_form_field.dart @@ -18,7 +18,7 @@ class OptionRowTextFormField extends StatelessWidget { @override Widget build(BuildContext context) { - String buffer = ''; + String buffer = controller != null ? controller.text : (initialValue ?? ''); return OptionRow( title: title, control: SizedBox( diff --git a/lib/views/setting.dart b/lib/views/setting.dart index e64eb76..b965c68 100644 --- a/lib/views/setting.dart +++ b/lib/views/setting.dart @@ -155,7 +155,7 @@ class _SettingsState extends State { itemCount: stashes.length, itemBuilder: (BuildContext context, int index) { return Container( - color: stashes[index].color, + color: stashes[index].colour, child: CheckboxListTile( value: (selectedTabs.contains(stashes[index].id)), onChanged: (isChecked) { @@ -293,9 +293,15 @@ class _SettingsState extends State { _poesessidController.text = poesessid; } + bool isInitStashTabsDone = true; Future initStashTabs() async { + if (!isInitStashTabsDone) return; + isInitStashTabsDone = false; final required = [selectedLeague, selectedRealm, accountName]; - if (required.any((element) => (element == null))) return; + if (required.any((element) => (element == null))) { + isInitStashTabsDone = true; + return; + } setState(() { stashes = null; }); @@ -305,6 +311,7 @@ class _SettingsState extends State { accountName: accountName, ); setState(() {}); + isInitStashTabsDone = true; } Future initSelectedStashTabs() async {