Skip to content

Commit

Permalink
chore: fix analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-athome committed Nov 16, 2023
1 parent cde24b8 commit c854aac
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 72 deletions.
18 changes: 8 additions & 10 deletions lib/helpers/cupertinoplus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ Widget buildCupertinoFormRowDivider(BuildContext context, bool shortDivider) {
/// An [InkWell] equivalent for Cupertino. Simply colors the background of the container.
class CupertinoInkWell extends StatefulWidget {
const CupertinoInkWell({
Key? key,
super.key,
required this.child,
required this.onPressed,
this.backgroundColor,
}) : super(key: key);
});

final Widget child;
final VoidCallback? onPressed;
Expand Down Expand Up @@ -123,9 +123,9 @@ class _CupertinoInkWellState extends State<CupertinoInkWell> {
/// A standard-sized container for a [CupertinoFormRow] child.
class CupertinoFormRowContainer extends StatelessWidget {
const CupertinoFormRowContainer({
Key? key,
super.key,
this.child,
}) : super(key: key);
});

final Widget? child;

Expand All @@ -143,15 +143,15 @@ class CupertinoFormRowContainer extends StatelessWidget {
/// A button-like [CupertinoFormRow]. Heavily inspired by [CupertinoButton].
class CupertinoFormButtonRow extends StatefulWidget {
const CupertinoFormButtonRow({
Key? key,
super.key,
required this.child,
this.prefix,
this.padding,
this.helper,
this.error,
this.pressedOpacity = 0.4,
required this.onPressed,
}) : super(key: key);
});

final Widget? prefix;
final EdgeInsetsGeometry? padding;
Expand Down Expand Up @@ -193,7 +193,7 @@ class _CupertinoFormButtonRowState extends State<CupertinoFormButtonRow>
class CupertinoDateTimeFormFieldRow extends FormField<DateTime> {
// TODO other constructor parameters
CupertinoDateTimeFormFieldRow({
Key? key,
super.key,
this.prefix,
this.controller,
this.helper,
Expand All @@ -202,13 +202,11 @@ class CupertinoDateTimeFormFieldRow extends FormField<DateTime> {
required this.doneButtonText,
DateTime? initialValue,
void Function(DateTime value, DateTime oldValue)? onChanged,
FormFieldSetter<DateTime>? onSaved,
super.onSaved,
}) : assert(showDate || showTime,
'showDate and showTime cannot be both false!'),
super(
key: key,
initialValue: controller?.value ?? initialValue ?? DateTime.now(),
onSaved: onSaved,
builder: (FormFieldState<DateTime> field) {
void onTapDateHandler() {
showCupertinoModalPopup(
Expand Down
23 changes: 10 additions & 13 deletions lib/helpers/digit_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ final NumberFormat kHoursFormatter = NumberFormat("00000.00");

class DigitDisplayFormTextField extends FormField<num> {
DigitDisplayFormTextField({
Key? key,
super.key,
DigitDisplayController? controller,
FormFieldSetter<num>? onSaved,
FormFieldValidator<num>? validator,
super.onSaved,
super.validator,
double fontSize = _kDefaultDigitFontSize,
EdgeInsetsGeometry padding = _kDefaultDigitPadding,
}) : super(
key: key,
onSaved: onSaved,
initialValue: controller?.value.number,
validator: validator,
builder: (field) {
return DigitDisplayTextField(
controller: controller,
Expand All @@ -33,13 +30,13 @@ class DigitDisplayFormTextField extends FormField<num> {

class DigitDisplayTextField extends StatefulWidget {
const DigitDisplayTextField({
Key? key,
super.key,
this.controller,
this.fontSize = _kDefaultDigitFontSize,
this.errorText,
this.padding = _kDefaultDigitPadding,
this.enabled = false,
}) : super(key: key);
});

final DigitDisplayController? controller;
final double fontSize;
Expand Down Expand Up @@ -145,14 +142,13 @@ class DigitDisplay {

class SingleDigitText extends StatelessWidget {
const SingleDigitText({
Key? key,
super.key,
required this.digit,
this.decimal = false,
this.fontSize = _kDefaultDigitFontSize,
this.active = false,
this.onTap,
}) : assert(digit >= 0 && digit <= 9),
super(key: key);
}) : assert(digit >= 0 && digit <= 9);

final int digit;
final bool decimal;
Expand All @@ -172,13 +168,14 @@ class SingleDigitText extends StatelessWidget {

class _DigitText extends StatelessWidget {
const _DigitText({
Key? key,
// ignore: unused_element
super.key,
required this.text,
this.alternate = false,
this.fontSize = _kDefaultDigitFontSize,
this.active = false,
this.onTap,
}) : super(key: key);
});

final String text;
final bool alternate;
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/future_progress_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class FutureProgressDialog extends StatefulWidget {

const FutureProgressDialog(
this.future, {
Key? key,
super.key,
this.decoration,
this.opacity = 1.0,
this.progress,
this.message,
}) : super(key: key);
});

@override
State<FutureProgressDialog> createState() => _FutureProgressDialogState();
Expand Down
8 changes: 4 additions & 4 deletions lib/helpers/list_tiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class DateListTile extends StatelessWidget {
static final DateFormat _dateFormatter = DateFormat.yMEd();

const DateListTile({
Key? key,
super.key,
required this.controller,
this.onDateSelected,
// ignore: unused_element
this.showIcon = true,
this.textStyle,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -79,12 +79,12 @@ class DateTimeListTile extends StatelessWidget {
static final DateFormat _dateFormatter = DateFormat.yMEd();

const DateTimeListTile({
Key? key,
super.key,
required this.controller,
required this.onDateSelected,
required this.onTimeSelected,
this.showIcon = true,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/pilot_select_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class PilotSelectList extends StatelessWidget {
final Function(String selected) onSelection;

const PilotSelectList({
Key? key,
super.key,
required this.pilotNames,
required this.avatarProvider,
required this.onSelection,
this.selectedName,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
14 changes: 7 additions & 7 deletions lib/helpers/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class DownloadProvider extends ChangeNotifier {

/// A basic controller for date and time pickers.
class DateTimePickerController extends ValueNotifier<DateTime?> {
DateTimePickerController(DateTime? value) : super(value);
DateTimePickerController(super.value);
}

/// Basic layout for indicating that an exception occurred.
Expand All @@ -261,8 +261,8 @@ class FirstPageExceptionIndicator extends StatelessWidget {
required this.title,
this.message,
this.onTryAgain,
Key? key,
}) : super(key: key);
super.key,
});

final String title;
final String? message;
Expand Down Expand Up @@ -342,8 +342,8 @@ class FirstPageExceptionIndicator extends StatelessWidget {
class FooterTile extends StatelessWidget {
const FooterTile({
required this.child,
Key? key,
}) : super(key: key);
super.key,
});

final Widget child;

Expand All @@ -360,10 +360,10 @@ class FooterTile extends StatelessWidget {
/// Forked from [infinite\_scroll\_pagination].
class NewPageErrorIndicator extends StatelessWidget {
const NewPageErrorIndicator({
Key? key,
super.key,
required this.message,
this.onTap,
}) : super(key: key);
});
final String message;
final VoidCallback? onTap;

Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Future<void> main() async {
}

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

@override
State<MyApp> createState() => _MyAppState();
Expand Down
9 changes: 4 additions & 5 deletions lib/screens/about/about_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final Logger _log = Logger((AboutScreen).toString());

// TODO convert to stateless widget if using only AppConfig
class AboutScreen extends StatefulWidget {
const AboutScreen({Key? key}) : super(key: key);
const AboutScreen({super.key});

@override
State<AboutScreen> createState() => _AboutScreenState();
Expand Down Expand Up @@ -358,8 +358,7 @@ class _AboutScreenState extends State<AboutScreen> {
leading: CircleAvatar(
foregroundImage: _appConfig.getPilotAvatar(e)),
title: Text(e),
))
.toList(growable: false),
)),
HeaderListTile(AppLocalizations.of(context)!.appName),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
Expand Down Expand Up @@ -514,9 +513,9 @@ class _AboutScreenState extends State<AboutScreen> {
class HeaderListTile extends StatelessWidget {
const HeaderListTile(
this.text, {
Key? key,
super.key,
this.first = false,
}) : super(key: key);
});

/// The text to be displayed.
final String text;
Expand Down
9 changes: 5 additions & 4 deletions lib/screens/activities/activities_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class ActivitiesList extends StatefulWidget {
final ActivitiesService activitiesService;

const ActivitiesList({
Key? key,
super.key,
required this.controller,
required this.activitiesService,
}) : super(key: key);
});

@override
State<ActivitiesList> createState() => _ActivitiesListState();
Expand Down Expand Up @@ -205,9 +205,10 @@ class _EntryListItem extends StatelessWidget {
static final DateFormat _dateFormatter = DateFormat.yMd();

const _EntryListItem({
Key? key,
// ignore: unused_element
super.key,
required this.entry,
}) : super(key: key);
});

final ActivityEntry entry;

Expand Down
2 changes: 1 addition & 1 deletion lib/screens/activities/activities_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../../services/activities_services.dart';
import 'activities_list.dart';

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

@override
State<ActivitiesScreen> createState() => _ActivitiesScreenState();
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/aircraft_select/aircraft_data_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import '../../helpers/utils.dart';
final Logger _log = Logger((AircraftData).toString());

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

@override
State<StatefulWidget> createState() => _SetAircraftDataScreenState();
Expand Down
7 changes: 4 additions & 3 deletions lib/screens/book_flight/book_flight_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import '../../services/book_flight_services.dart';
final Logger _log = Logger((FlightBooking).toString());

class BookFlightModal extends StatefulWidget {
const BookFlightModal(this.event, {Key? key}) : super(key: key);
const BookFlightModal(this.event, {super.key});

final FlightBooking event;

Expand Down Expand Up @@ -526,10 +526,11 @@ class _SunTimesListTile extends StatelessWidget {
final DateTime sunset;

const _SunTimesListTile({
Key? key,
// ignore: unused_element
super.key,
required this.sunrise,
required this.sunset,
}) : super(key: key);
});

Color? _getIconColor(BuildContext context) =>
getBrightness(context) == Brightness.dark ? null : Colors.black45;
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/book_flight/book_flight_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Color _resolveEventBackgroundColor(BuildContext context) =>
const _kEventDefaultDuration = Duration(hours: 1);

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

@override
BookFlightScreenState createState() => BookFlightScreenState();
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/flight_log/flight_log_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ final Logger _log = Logger((FlightLogItem).toString());

class FlightLogList extends StatefulWidget {
const FlightLogList({
Key? key,
super.key,
required this.controller,
required this.logBookService,
required this.onTapItem,
}) : super(key: key);
});

final FlightLogListController controller;
final FlightLogBookService logBookService;
Expand Down
6 changes: 3 additions & 3 deletions lib/screens/flight_log/flight_log_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ num _parseFuelPrice(String text) =>
roundDouble(_fuelPriceFormatter.parse(text), _kFuelPriceDecimals);

class FlightLogModal extends StatefulWidget {
const FlightLogModal(this.item, {Key? key}) : super(key: key);
const FlightLogModal(this.item, {super.key});

final FlightLogItem item;

Expand Down Expand Up @@ -750,12 +750,12 @@ class _MaterialFuelPriceSelector extends StatelessWidget {
/// Builds a fuel price text input field.
/// onChanged will give the total cost.
const _MaterialFuelPriceSelector.totalCost({
Key? key,
super.key,
// ignore: unused_element
this.onChanged,
required this.currencySymbol,
required this.textController,
}) : super(key: key);
});

final TextEditingController? textController;
final void Function(num? value)? onChanged;
Expand Down
Loading

0 comments on commit c854aac

Please sign in to comment.