Skip to content

Commit

Permalink
chore: upgrade flutter and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgomesdev committed Jan 14, 2024
1 parent 4ceebf1 commit 8d36b2e
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 290 deletions.
2 changes: 1 addition & 1 deletion app/lib/bloc/effect_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:rusty_controller/model/led_effects.dart';
import '../service/controller_service.dart';

class EffectBloc extends Bloc<EffectChangeEvent, LedEffect> {
EffectBloc(LedEffect effect) : super(effect) {
EffectBloc(super.effect) {
final service = serviceLocator.get<ControllerService>();

on<EffectSettingChangeEvent>((event, emit) async {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/bloc/effects/breathing_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:rusty_controller/model/led_effects.dart';

class BreathingBloc
extends SpecificEffectBloc<BreathingEffectEvent, BreathingLedEffect> {
BreathingBloc(BreathingLedEffect effect) : super(effect) {
BreathingBloc(super.effect) {
on<BreathingColorEvent>(
(event, emit) => emit(state..color = event.currentColor));
on<BreathingTimeEvent>(
Expand Down
2 changes: 1 addition & 1 deletion app/lib/bloc/effects/rainbow_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:rusty_controller/model/led_effects.dart';

class RainbowBloc
extends SpecificEffectBloc<RainbowEffectEvent, RainbowLedEffect> {
RainbowBloc(RainbowLedEffect effect) : super(effect) {
RainbowBloc(super.effect) {
on<RainbowSaturationEvent>(
(event, emit) => emit(state..saturation = event.saturation));
on<RainbowValueEvent>((event, emit) => emit(state..value = event.value));
Expand Down
2 changes: 1 addition & 1 deletion app/lib/bloc/effects/static_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:rusty_controller/model/led_effects.dart';

class StaticBloc
extends SpecificEffectBloc<StaticEffectEvent, StaticLedEffect> {
StaticBloc(StaticLedEffect effect) : super(effect) {
StaticBloc(super.effect) {
on<StaticColorEvent>(
(event, emit) => emit(state..color = event.currentColor));
}
Expand Down
2 changes: 1 addition & 1 deletion app/lib/bloc/specific_effect_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ abstract class SpecificEffectBloc<EffectEvent, State extends LedEffect>
const Duration(milliseconds: 100),
);

SpecificEffectBloc(State initialState) : super(initialState);
SpecificEffectBloc(super.initialState);

@override
void on<E extends EffectEvent>(
Expand Down
4 changes: 2 additions & 2 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:rusty_controller/service/controller_service.dart';
import 'package:rusty_controller/service/discovery_service.dart';
import 'package:rusty_controller/service/store_service.dart';

final log = Logger(level: Level.verbose, printer: PrettyPrinter());
final log = Logger(level: Level.trace, printer: PrettyPrinter());
final serviceLocator = GetIt.instance;

final defaultEffects = {
Expand Down Expand Up @@ -102,7 +102,7 @@ void setupDependencies() {
}

class BaseScreen extends StatelessWidget {
const BaseScreen({Key? key}) : super(key: key);
const BaseScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/screen/effect_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:rusty_controller/widgets/effect_chooser.dart';
import 'package:rusty_controller/widgets/effect_widget.dart';

class EffectScreen extends StatelessWidget {
const EffectScreen({Key? key}) : super(key: key);
const EffectScreen({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -20,8 +20,8 @@ class EffectScreen extends StatelessWidget {
children: [
Expanded(
child: Padding(
child: EffectChooser(currentEffect: effect, bloc: bloc),
padding: const EdgeInsets.only(left: 8.0),
child: EffectChooser(currentEffect: effect, bloc: bloc),
),
),
Flexible(
Expand Down
2 changes: 1 addition & 1 deletion app/lib/screen/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:rusty_controller/main.dart';
import 'package:rusty_controller/screen/effect_screen.dart';

class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
const HomeScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/service/controller_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ControllerService {
if (msg.hasException) {
final exception = msg.exception!.linkException;
if (exception is NetworkException || exception is ServerException) {
log.w('Network error when sending effect', exception);
log.w('Network error when sending effect', error: exception);
serviceLocator.get<DiscoveryBloc>().add(NotConnectedEvent());
return;
}
Expand All @@ -63,7 +63,7 @@ class ControllerService {
if (msg.data?[effect.graphqlMutationName] == "SUCCESS") {
log.i("Mutation succeeded");
} else {
log.w("Server didn't respond successfully to mutation.", msg.data);
log.w("Server didn't respond successfully to mutation. (response: msg.data)");
}
}, onError: (msg, _) => log.e(msg))._reconnectOnTimeout();
}
Expand Down
6 changes: 3 additions & 3 deletions app/lib/service/store_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class StoreService {
return (await save(defaultValue)) as T;
}

log.v("Got file of store '${defaultValue.storeName}'");
log.t("Got file of store '${defaultValue.storeName}'");
return Future.value(value as T);
} catch (e) {
log.w('Failed to get value for ${defaultValue.storeName}.', e);
log.w('Failed to get value for ${defaultValue.storeName}.', error: e);
log.d('Writing default value provided.');
return (await save(defaultValue)) as T;
}
Expand All @@ -34,7 +34,7 @@ class StoreService {
final jsonContent = jsonEncode(value.toJson());

await file.writeAsString(jsonContent);
log.v('Stored object to file ${file.path}');
log.t('Stored object to file ${file.path}');

return value;
}
Expand Down
9 changes: 3 additions & 6 deletions app/lib/widgets/effect_chooser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class EffectChooser extends StatelessWidget {
final EffectBloc bloc;

const EffectChooser(
{Key? key, required this.bloc, required this.currentEffect})
: super(key: key);
{super.key, required this.bloc, required this.currentEffect});

@override
Widget build(BuildContext context) {
Expand All @@ -36,11 +35,9 @@ class _EffectChoice extends StatelessWidget {
final VoidCallback onSelected;

const _EffectChoice(
{Key? key,
required this.name,
{required this.name,
required this.isSelected,
required this.onSelected})
: super(key: key);
required this.onSelected});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/effect_settings/breathing_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:rusty_controller/widgets/effect_settings/common/labeled_slider.d
import 'package:rusty_controller/widgets/effect_settings/common/led_color_picker.dart';

class BreathingSettings extends StatefulWidget {
const BreathingSettings({Key? key}) : super(key: key);
const BreathingSettings({super.key});

@override
State<BreathingSettings> createState() => _BreathingSettingsState();
Expand Down
10 changes: 4 additions & 6 deletions app/lib/widgets/effect_settings/common/labeled_slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ class LabeledLogSlider extends StatelessWidget {
final void Function(double) onChanged;

LabeledLogSlider(
{Key? key,
{super.key,
required this.onChanged,
required this.label,
required this.value,
this.min = 1.0,
this.max = 10.0})
: scale = log(max) - log(min),
super(key: key);
: scale = log(max) - log(min);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -47,13 +46,12 @@ class LabeledSlider extends StatelessWidget {
final void Function(double) onChanged;

const LabeledSlider(
{Key? key,
{super.key,
required this.onChanged,
required this.label,
required this.value,
this.max = 1.0,
this.min = 0.0})
: super(key: key);
this.min = 0.0});

@override
Widget build(BuildContext context) {
Expand Down
5 changes: 2 additions & 3 deletions app/lib/widgets/effect_settings/common/led_color_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ class LedColorPicker extends StatefulWidget {

/// [ignoreValue] ignores [currentColor.value], overriding to 1.0
const LedColorPicker(
{Key? key,
{super.key,
required this.currentColor,
required this.onColorPick,
this.ignoreValue = false})
: super(key: key);
this.ignoreValue = false});

@override
State<LedColorPicker> createState() => _LedColorPickerState();
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/effect_settings/off_settings.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class OffEffectWidget extends StatelessWidget {
const OffEffectWidget({Key? key}) : super(key: key);
const OffEffectWidget({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/effect_settings/rainbow_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:rusty_controller/model/led_effects.dart';
import 'package:rusty_controller/widgets/effect_settings/common/labeled_slider.dart';

class RainbowSettings extends StatefulWidget {
const RainbowSettings({Key? key}) : super(key: key);
const RainbowSettings({super.key});

@override
State<RainbowSettings> createState() => _RainbowSettingsState();
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/effect_settings/static_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:rusty_controller/model/led_effects.dart';
import 'package:rusty_controller/widgets/effect_settings/common/led_color_picker.dart';

class StaticSettings extends StatelessWidget {
const StaticSettings({Key? key}) : super(key: key);
const StaticSettings({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/effect_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:rusty_controller/widgets/effect_settings/static_settings.dart';
class EffectWidget<T extends LedEffect> extends StatelessWidget {
final T currentEffect;

const EffectWidget(this.currentEffect, {Key? key}) : super(key: key);
const EffectWidget(this.currentEffect, {super.key});

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit 8d36b2e

Please sign in to comment.