Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Jun 12, 2024
1 parent 92140b2 commit 8a8ed53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/Frontend/pages/move_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class _EditMoveList extends ConsumerState<EditMoveList> with TickerProviderState
floatingActionButton: moveList!.moves.length < 6
? FloatingActionButton.extended(
icon: const Icon(Icons.add),
onPressed: () {
onPressed: () async {
setState(
() {
moveList!.moves.add(Move());
Expand Down Expand Up @@ -209,7 +209,7 @@ class _EditMoveList extends ConsumerState<EditMoveList> with TickerProviderState
maxLines: 1,
maxLength: 30,
autocorrect: false,
onSubmitted: (nameValue) {
onSubmitted: (nameValue) async {
setState(
() {
moveList!.name = nameValue;
Expand All @@ -221,7 +221,7 @@ class _EditMoveList extends ConsumerState<EditMoveList> with TickerProviderState
),
DeviceTypeWidget(
selected: moveList!.deviceCategory,
onSelectionChanged: (List<DeviceType> value) {
onSelectionChanged: (List<DeviceType> value) async {
setState(() => moveList!.deviceCategory = value.toList());
ref.watch(moveListsProvider.notifier).store();
},
Expand All @@ -235,7 +235,7 @@ class _EditMoveList extends ConsumerState<EditMoveList> with TickerProviderState
max: 5,
divisions: 4,
label: "${moveList!.repeat.toInt()}",
onChanged: (double value) {
onChanged: (double value) async {
setState(() {
setState(() => moveList!.repeat = value);
ref.watch(moveListsProvider.notifier).store();
Expand All @@ -253,7 +253,7 @@ class _EditMoveList extends ConsumerState<EditMoveList> with TickerProviderState
key: Key('$index'),
title: Text(moveList!.moves[index].toString()),
leading: Icon(moveList!.moves[index].moveType.icon),
onTap: () {
onTap: () async {
editModal(context, index);
//context.push<Move>("/moveLists/editMoveList/editMove", extra: moveList!.moves[index]).then((value) => setState(() => moveList!.moves[index] = value!));
},
Expand All @@ -278,7 +278,7 @@ class _EditMoveList extends ConsumerState<EditMoveList> with TickerProviderState
);
}

void editModal(BuildContext context, int index) {
Future<void> editModal(BuildContext context, int index) async {
Move move = moveList!.moves[index];
if (_tabController != null) {
//There is probably a much better way to remove listeners
Expand Down
7 changes: 2 additions & 5 deletions lib/Frontend/pages/ota_update.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import '../translation_string_definitions.dart';
import '../utils.dart';

class OtaUpdate extends ConsumerStatefulWidget {
const OtaUpdate({super.key, required this.device});
const OtaUpdate({required this.device, super.key});

final String device;

Expand Down Expand Up @@ -79,9 +79,6 @@ class _OtaUpdateState extends ConsumerState<OtaUpdate> {
if (!wakelockEnabledBeforehand) {
unawaited(WakelockPlus.disable());
}
if ([OtaState.download, OtaState.upload].contains(otaState)) {
otaState == OtaState.error;
}
baseStatefulDevice?.deviceState.value = DeviceState.standby;
baseStatefulDevice!.fwVersion.removeListener(verListener);
baseStatefulDevice!.fwInfo.removeListener(fwInfoListener);
Expand Down Expand Up @@ -426,7 +423,7 @@ class _OtaUpdateState extends ConsumerState<OtaUpdate> {
List<int> beginOTA = List.from(const Utf8Encoder().convert("OTA ${firmwareFile!.length} $downloadedMD5"));
await sendMessage(baseStatefulDevice!, beginOTA);

while (uploadProgress < 1 && otaState != OtaState.error) {
while (uploadProgress < 1 && otaState != OtaState.error && mounted) {
baseStatefulDevice!.deviceState.value = DeviceState.busy; // hold the command queue
if (baseStatefulDevice!.gearReturnedError.value) {
transaction.status = const SpanStatus.unavailable();
Expand Down

0 comments on commit 8a8ed53

Please sign in to comment.