fixed weird warnings

This commit is contained in:
Kima 2023-12-09 16:52:52 +01:00
parent 646948012d
commit 5079e0cb29
24 changed files with 58 additions and 51 deletions

View File

@ -62,11 +62,10 @@ class App extends StatelessWidget {
final DatabaseProvider database; final DatabaseProvider database;
const App( const App(
{Key? key, {super.key,
required this.database, required this.database,
required this.settings, required this.settings,
required this.user}) required this.user});
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -17,7 +17,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
void main() async { void main() async {
// Initalize // Initalize
WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized(); WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
binding.renderView.automaticSystemUiAdjustment = false; binding.renderViews.first.automaticSystemUiAdjustment = false;
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// Startup // Startup
Startup startup = Startup(); Startup startup = Startup();

View File

@ -87,13 +87,13 @@ Widget _defaultItemBuilder(Color color, bool isCurrentColor, void Function() cha
// The blocky color picker you can alter the layout and shape. // The blocky color picker you can alter the layout and shape.
class BlockPicker extends StatefulWidget { class BlockPicker extends StatefulWidget {
BlockPicker({ BlockPicker({
Key? key, super.key,
required this.pickerColor, required this.pickerColor,
required this.onColorChanged, required this.onColorChanged,
this.useInShowDialog = true, this.useInShowDialog = true,
this.layoutBuilder = _defaultLayoutBuilder, this.layoutBuilder = _defaultLayoutBuilder,
this.itemBuilder = _defaultItemBuilder, this.itemBuilder = _defaultItemBuilder,
}) : super(key: key); });
final Color? pickerColor; final Color? pickerColor;
final ValueChanged<Color> onColorChanged; final ValueChanged<Color> onColorChanged;

View File

@ -7,6 +7,8 @@
/// ///
/// You can create your own layout by importing `picker.dart`. /// You can create your own layout by importing `picker.dart`.
// ignore_for_file: use_build_context_synchronously
library hsv_picker; library hsv_picker;
import 'package:filcnaplo/models/shared_theme.dart'; import 'package:filcnaplo/models/shared_theme.dart';
@ -24,7 +26,7 @@ import 'package:provider/provider.dart';
class FilcColorPicker extends StatefulWidget { class FilcColorPicker extends StatefulWidget {
const FilcColorPicker({ const FilcColorPicker({
Key? key, super.key,
required this.colorMode, required this.colorMode,
required this.pickerColor, required this.pickerColor,
required this.onColorChanged, required this.onColorChanged,
@ -53,7 +55,7 @@ class FilcColorPicker extends StatefulWidget {
this.colorHistory, this.colorHistory,
this.onHistoryChanged, this.onHistoryChanged,
required this.onThemeIdProvided, required this.onThemeIdProvided,
}) : super(key: key); });
final CustomColorMode colorMode; final CustomColorMode colorMode;
final Color pickerColor; final Color pickerColor;
@ -78,10 +80,10 @@ class FilcColorPicker extends StatefulWidget {
final void Function(SharedTheme theme) onThemeIdProvided; final void Function(SharedTheme theme) onThemeIdProvided;
@override @override
_FilcColorPickerState createState() => _FilcColorPickerState(); FilcColorPickerState createState() => FilcColorPickerState();
} }
class _FilcColorPickerState extends State<FilcColorPicker> { class FilcColorPickerState extends State<FilcColorPicker> {
final idController = TextEditingController(); final idController = TextEditingController();
late final ShareProvider shareProvider; late final ShareProvider shareProvider;

View File

@ -3,6 +3,7 @@
// FROM: https://pub.dev/packages/flutter_colorpicker // FROM: https://pub.dev/packages/flutter_colorpicker
// FROM: https://pub.dev/packages/flutter_colorpicker // FROM: https://pub.dev/packages/flutter_colorpicker
// ignore: dangling_library_doc_comments
/// The components of HSV Color Picker /// The components of HSV Color Picker
/// ///
/// Try to create a Color Picker with other layout on your own :) /// Try to create a Color Picker with other layout on your own :)
@ -317,11 +318,11 @@ class ColorPickerInput extends StatefulWidget {
const ColorPickerInput( const ColorPickerInput(
this.color, this.color,
this.onColorChanged, { this.onColorChanged, {
Key? key, super.key,
this.enableAlpha = true, this.enableAlpha = true,
this.embeddedText = false, this.embeddedText = false,
this.disable = false, this.disable = false,
}) : super(key: key); });
final Color color; final Color color;
final ValueChanged<Color> onColorChanged; final ValueChanged<Color> onColorChanged;
@ -330,10 +331,10 @@ class ColorPickerInput extends StatefulWidget {
final bool disable; final bool disable;
@override @override
_ColorPickerInputState createState() => _ColorPickerInputState(); ColorPickerInputState createState() => ColorPickerInputState();
} }
class _ColorPickerInputState extends State<ColorPickerInput> { class ColorPickerInputState extends State<ColorPickerInput> {
TextEditingController textEditingController = TextEditingController(); TextEditingController textEditingController = TextEditingController();
int inputColor = 0; int inputColor = 0;
@ -346,11 +347,7 @@ class _ColorPickerInputState extends State<ColorPickerInput> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (inputColor != widget.color.value) { if (inputColor != widget.color.value) {
textEditingController.text = '#' + textEditingController.text = '#${widget.color.red.toRadixString(16).toUpperCase().padLeft(2, '0')}${widget.color.green.toRadixString(16).toUpperCase().padLeft(2, '0')}${widget.color.blue.toRadixString(16).toUpperCase().padLeft(2, '0')}${widget.enableAlpha ? widget.color.alpha.toRadixString(16).toUpperCase().padLeft(2, '0') : ''}';
widget.color.red.toRadixString(16).toUpperCase().padLeft(2, '0') +
widget.color.green.toRadixString(16).toUpperCase().padLeft(2, '0') +
widget.color.blue.toRadixString(16).toUpperCase().padLeft(2, '0') +
(widget.enableAlpha ? widget.color.alpha.toRadixString(16).toUpperCase().padLeft(2, '0') : '');
} }
return Padding( return Padding(
padding: const EdgeInsets.only(top: 6.0, left: 12.0, right: 12.0), padding: const EdgeInsets.only(top: 6.0, left: 12.0, right: 12.0),
@ -516,10 +513,10 @@ class ColorPickerSlider extends StatelessWidget {
this.onColorChanged, this.onColorChanged,
this.onColorChangeEnd, this.onColorChangeEnd,
this.onProblem, { this.onProblem, {
Key? key, super.key,
this.displayThumbColor = false, this.displayThumbColor = false,
this.fullThumbColor = false, this.fullThumbColor = false,
}) : super(key: key); });
final TrackType trackType; final TrackType trackType;
final HSVColor hsvColor; final HSVColor hsvColor;
@ -657,13 +654,13 @@ class ColorPickerSlider extends StatelessWidget {
class ColorIndicator extends StatelessWidget { class ColorIndicator extends StatelessWidget {
const ColorIndicator( const ColorIndicator(
this.hsvColor, { this.hsvColor, {
Key? key, super.key,
this.currentHsvColor, this.currentHsvColor,
this.icon, this.icon,
this.width = 50.0, this.width = 50.0,
this.height = 50.0, this.height = 50.0,
this.adaptive = false, this.adaptive = false,
}) : super(key: key); });
final HSVColor hsvColor; final HSVColor hsvColor;
final HSVColor? currentHsvColor; final HSVColor? currentHsvColor;
@ -711,8 +708,8 @@ class ColorPickerArea extends StatelessWidget {
this.onColorChanged, this.onColorChanged,
this.onChangeEnd, this.onChangeEnd,
this.paletteType, { this.paletteType, {
Key? key, super.key,
}) : super(key: key); });
final HSVColor hsvColor; final HSVColor hsvColor;
final ValueChanged<HSVColor> onColorChanged; final ValueChanged<HSVColor> onColorChanged;

View File

@ -3,6 +3,7 @@
// FROM: https://pub.dev/packages/flutter_colorpicker // FROM: https://pub.dev/packages/flutter_colorpicker
// FROM: https://pub.dev/packages/flutter_colorpicker // FROM: https://pub.dev/packages/flutter_colorpicker
// ignore: dangling_library_doc_comments
/// Common function lib /// Common function lib
import 'dart:math'; import 'dart:math';

View File

@ -12,12 +12,12 @@ import 'package:provider/provider.dart';
class GradeTile extends StatelessWidget { class GradeTile extends StatelessWidget {
const GradeTile( const GradeTile(
this.grade, { this.grade, {
Key? key, super.key,
this.onTap, this.onTap,
this.padding, this.padding,
this.censored = false, this.censored = false,
this.viewOverride = false, this.viewOverride = false,
}) : super(key: key); });
final Grade grade; final Grade grade;
final void Function()? onTap; final void Function()? onTap;
@ -194,7 +194,7 @@ class GradeTile extends StatelessWidget {
class GradeValueWidget extends StatelessWidget { class GradeValueWidget extends StatelessWidget {
const GradeValueWidget( const GradeValueWidget(
this.value, { this.value, {
Key? key, super.key,
this.size = 38.0, this.size = 38.0,
this.fill = false, this.fill = false,
this.contrast = false, this.contrast = false,
@ -203,7 +203,7 @@ class GradeValueWidget extends StatelessWidget {
this.complemented = false, this.complemented = false,
this.nocolor = false, this.nocolor = false,
this.color, this.color,
}) : super(key: key); });
final GradeValue value; final GradeValue value;
final double size; final double size;

View File

@ -16,8 +16,7 @@ import 'package:provider/provider.dart';
import 'lesson_tile.i18n.dart'; import 'lesson_tile.i18n.dart';
class LessonTile extends StatelessWidget { class LessonTile extends StatelessWidget {
const LessonTile(this.lesson, {Key? key, this.onTap, this.swapDesc = false}) const LessonTile(this.lesson, {super.key, this.onTap, this.swapDesc = false});
: super(key: key);
final Lesson lesson; final Lesson lesson;
final bool swapDesc; final bool swapDesc;
@ -287,8 +286,7 @@ enum LessonSubtileType { homework, exam, absence }
class LessonSubtile extends StatelessWidget { class LessonSubtile extends StatelessWidget {
const LessonSubtile( const LessonSubtile(
{Key? key, this.onPressed, required this.title, required this.type}) {super.key, this.onPressed, required this.title, required this.type});
: super(key: key);
final Function()? onPressed; final Function()? onPressed;
final String title; final String title;

View File

@ -11,12 +11,12 @@ import 'package:provider/provider.dart';
class MessageTile extends StatelessWidget { class MessageTile extends StatelessWidget {
const MessageTile( const MessageTile(
this.message, { this.message, {
Key? key, super.key,
this.messages, this.messages,
this.padding, this.padding,
this.onTap, this.onTap,
this.censored = false, this.censored = false,
}) : super(key: key); });
final Message message; final Message message;
final List<Message>? messages; final List<Message>? messages;

View File

@ -1,4 +1,4 @@
// ignore_for_file: avoid_print // ignore_for_file: avoid_print, use_build_context_synchronously
import 'dart:async'; import 'dart:async';
import 'dart:developer'; import 'dart:developer';

View File

@ -1,3 +1,5 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
import 'package:filcnaplo/utils/format.dart'; import 'package:filcnaplo/utils/format.dart';
import 'category.dart'; import 'category.dart';
import 'subject.dart'; import 'subject.dart';

View File

@ -1,3 +1,5 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
import 'package:filcnaplo_kreta_api/controllers/timetable_controller.dart'; import 'package:filcnaplo_kreta_api/controllers/timetable_controller.dart';
class Week { class Week {

View File

@ -1,3 +1,5 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
import 'package:filcnaplo/api/providers/user_provider.dart'; import 'package:filcnaplo/api/providers/user_provider.dart';
import 'package:filcnaplo/api/providers/database_provider.dart'; import 'package:filcnaplo/api/providers/database_provider.dart';
import 'package:filcnaplo/models/user.dart'; import 'package:filcnaplo/models/user.dart';
@ -49,6 +51,7 @@ class AbsenceProvider with ChangeNotifier {
(await _database.query.getSettings(_database)).renamedTeachersEnabled (await _database.query.getSettings(_database)).renamedTeachersEnabled
? await _database.userQuery.renamedTeachers( ? await _database.userQuery.renamedTeachers(
userId: userId:
// ignore: use_build_context_synchronously
Provider.of<UserProvider>(_context, listen: false).user!.id) Provider.of<UserProvider>(_context, listen: false).user!.id)
: {}; : {};

View File

@ -49,6 +49,7 @@ class ExamProvider with ChangeNotifier {
(await database.query.getSettings(database)).renamedTeachersEnabled (await database.query.getSettings(database)).renamedTeachersEnabled
? await database.userQuery.renamedTeachers( ? await database.userQuery.renamedTeachers(
userId: userId:
// ignore: use_build_context_synchronously
Provider.of<UserProvider>(_context, listen: false).user!.id) Provider.of<UserProvider>(_context, listen: false).user!.id)
: {}; : {};

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ActionButton extends StatelessWidget { class ActionButton extends StatelessWidget {
const ActionButton({Key? key, required this.label, this.activeColor, this.onTap}) : super(key: key); const ActionButton({super.key, required this.label, this.activeColor, this.onTap});
final Color? activeColor; final Color? activeColor;
final void Function()? onTap; final void Function()? onTap;

View File

@ -4,8 +4,7 @@ import 'package:flutter/material.dart';
import 'package:i18n_extension/i18n_widget.dart'; import 'package:i18n_extension/i18n_widget.dart';
class AverageDisplay extends StatelessWidget { class AverageDisplay extends StatelessWidget {
const AverageDisplay({Key? key, this.average = 0.0, this.border = false}) const AverageDisplay({super.key, this.average = 0.0, this.border = false});
: super(key: key);
final double average; final double average;
final bool border; final bool border;

View File

@ -2,7 +2,7 @@ import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BetaChip extends StatelessWidget { class BetaChip extends StatelessWidget {
const BetaChip({Key? key, this.disabled = false}) : super(key: key); const BetaChip({super.key, this.disabled = false});
final bool disabled; final bool disabled;
@ -12,6 +12,12 @@ class BetaChip extends StatelessWidget {
height: 25, height: 25,
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: BoxDecoration(
color: !disabled
? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25),
borderRadius: BorderRadius.circular(40),
),
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 8, right: 8), padding: const EdgeInsets.only(left: 8, right: 8),
child: Center( child: Center(
@ -29,12 +35,6 @@ class BetaChip extends StatelessWidget {
), ),
), ),
), ),
decoration: BoxDecoration(
color: !disabled
? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25),
borderRadius: BorderRadius.circular(40),
),
), ),
); );
} }

View File

@ -2,7 +2,7 @@ import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BottomCard extends StatelessWidget { class BottomCard extends StatelessWidget {
const BottomCard({Key? key, this.child}) : super(key: key); const BottomCard({super.key, this.child});
final Widget? child; final Widget? child;

View File

@ -2,7 +2,7 @@ import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/rounded_bottom_shee
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BottomSheetMenu extends StatelessWidget { class BottomSheetMenu extends StatelessWidget {
const BottomSheetMenu({Key? key, this.items = const []}) : super(key: key); const BottomSheetMenu({super.key, this.items = const []});
final List<Widget> items; final List<Widget> items;

View File

@ -2,7 +2,7 @@ import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BottomSheetMenuItem extends StatelessWidget { class BottomSheetMenuItem extends StatelessWidget {
const BottomSheetMenuItem({Key? key, required this.onPressed, required this.title, this.icon}) : super(key: key); const BottomSheetMenuItem({super.key, required this.onPressed, required this.title, this.icon});
final void Function()? onPressed; final void Function()? onPressed;
final Widget? title; final Widget? title;

View File

@ -10,6 +10,7 @@ SnackBar CustomSnackBar({
Duration? duration, Duration? duration,
}) { }) {
// backgroundColor > Brightness > Theme Background // backgroundColor > Brightness > Theme Background
// ignore: no_leading_underscores_for_local_identifiers
Color _backgroundColor = backgroundColor ?? (AppColors.fromBrightness(brightness ?? Theme.of(context).brightness).highlight); Color _backgroundColor = backgroundColor ?? (AppColors.fromBrightness(brightness ?? Theme.of(context).brightness).highlight);
Color textColor = AppColors.fromBrightness(brightness ?? Theme.of(context).brightness).text; Color textColor = AppColors.fromBrightness(brightness ?? Theme.of(context).brightness).text;

View File

@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:filcnaplo/models/settings.dart'; import 'package:filcnaplo/models/settings.dart';
import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_kreta_api/models/grade.dart'; import 'package:filcnaplo_kreta_api/models/grade.dart';

View File

@ -8,7 +8,7 @@ import 'package:flutter_custom_tabs/flutter_custom_tabs.dart';
import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:flutter_linkify/flutter_linkify.dart';
class NoteView extends StatelessWidget { class NoteView extends StatelessWidget {
const NoteView(this.note, {Key? key}) : super(key: key); const NoteView(this.note, {super.key});
final Note note; final Note note;

View File

@ -4,7 +4,7 @@ import 'package:filcnaplo_mobile_ui/common/widgets/note/note_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class NoteViewable extends StatelessWidget { class NoteViewable extends StatelessWidget {
const NoteViewable(this.note, {Key? key}) : super(key: key); const NoteViewable(this.note, {super.key});
final Note note; final Note note;