Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgraded depricated members #188

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 93 additions & 2 deletions lib/theme/app_theme.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';

import 'package:rutorrentflutter/ui/shared/shared_styles.dart';

class AppTheme {
Expand All @@ -10,9 +11,54 @@ class AppTheme {
),
primaryColor: kBluePrimaryLT,
disabledColor: kGreyLT,
toggleableActiveColor: kIndigoSecondaryLT,
colorScheme:
ColorScheme.fromSwatch().copyWith(secondary: kIndigoSecondaryLT),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kIndigoSecondaryLT;
}
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kIndigoSecondaryLT;
}
return null;
}),
),
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kIndigoSecondaryLT;
}
return null;
}),
),
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kIndigoSecondaryLT;
}
return null;
}),
),
);

static final ThemeData darkTheme = ThemeData.dark().copyWith(
Expand All @@ -23,7 +69,52 @@ class AppTheme {
),
primaryColor: kPrimaryDT,
disabledColor: kGreyDT,
toggleableActiveColor: kSecondaryDT,
colorScheme: ColorScheme.fromSwatch().copyWith(secondary: kSecondaryDT),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kSecondaryDT;
}
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kSecondaryDT;
}
return null;
}),
),
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kSecondaryDT;
}
return null;
}),
),
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return kSecondaryDT;
}
return null;
}),
),
);
}
2 changes: 1 addition & 1 deletion lib/ui/views/login/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class LoginView extends StatelessWidget {
side: BorderSide(
color: Theme.of(context).primaryColor),
),
primary: !AppStateNotifier.isDarkModeOn
backgroundColor: !AppStateNotifier.isDarkModeOn
? Colors.white
: Colors.black),
child: Padding(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/dumb_widgets/document_type_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DocumentTypeCard extends StatelessWidget {

@override
Widget build(BuildContext context) {
var subtitle1 = Theme.of(context).textTheme.subtitle1?.copyWith(
var subtitle1 = Theme.of(context).textTheme.titleMedium?.copyWith(
fontSize: 16,
color: (isSelected) ? Colors.white : Colors.black,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _PasswordChangeDialogState extends State<PasswordChangeDialog> {
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: !AppStateNotifier.isDarkModeOn
backgroundColor: !AppStateNotifier.isDarkModeOn
? Colors.white
: kGreyDT,
shape: RoundedRectangleBorder(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/dumb_widgets/torrent_label_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class TorrentLabelDialog extends StatelessWidget {
borderRadius: BorderRadius.circular(5.0),
side: BorderSide(color: Theme.of(context).primaryColor),
),
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// ignore_for_file: deprecated_member_use

import 'package:flutter/material.dart';

import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';

import 'package:rutorrentflutter/app/app.locator.dart';
import 'package:rutorrentflutter/enums/bottom_sheet_type.dart';
import 'package:rutorrentflutter/enums/enums.dart';
import 'package:rutorrentflutter/ui/widgets/dumb_widgets/text_field_view.dart';
import 'package:rutorrentflutter/ui/widgets/smart_widgets/bottom_sheets/confirm_bottom_sheet/confirm_bottom_sheet_view.dart';
import 'package:rutorrentflutter/ui/widgets/smart_widgets/bottom_sheets/option_bottom_sheet/option_bottom_sheet_view.dart';
import 'package:rutorrentflutter/ui/widgets/smart_widgets/bottom_sheets/sort_bottom_sheet/sort_bottom_sheet_view.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';

void setUpBottomSheetUi() {
final bottomSheetService = locator<BottomSheetService>();
Expand Down Expand Up @@ -85,15 +86,18 @@ class _FloatingBoxBottomSheet extends StatelessWidget {
fontWeight: FontWeight.bold),
),
),
FlatButton(
TextButton(
onPressed: () =>
model.response(completer, textFieldController1.text),
child: Text(
request.mainButtonTitle!,
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
color: Theme.of(context).primaryColor,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Theme.of(context).primaryColor),
),
)
],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';

import 'package:stacked_services/stacked_services.dart';

import 'package:rutorrentflutter/theme/app_state_notifier.dart';
import 'package:rutorrentflutter/ui/shared/shared_styles.dart';
import 'package:stacked_services/stacked_services.dart';

class ConfirmBottomSheetView extends StatelessWidget {
final SheetRequest request;
Expand Down Expand Up @@ -50,13 +52,16 @@ class ConfirmBottomSheetView extends StatelessWidget {
),
),
// ignore: deprecated_member_use
FlatButton(
TextButton(
onPressed: () => completer(SheetResponse(confirmed: true)),
child: Text(
request.mainButtonTitle!,
style: TextStyle(color: Colors.white),
),
color: Theme.of(context).primaryColor,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Theme.of(context).primaryColor),
),
)
],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// ignore_for_file: import_of_legacy_library_into_null_safe

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:stacked/stacked.dart';

import 'package:rutorrentflutter/enums/enums.dart';
import 'package:rutorrentflutter/theme/app_state_notifier.dart';
import 'package:rutorrentflutter/ui/widgets/dumb_widgets/data_input_widget.dart';
import 'package:rutorrentflutter/ui/widgets/smart_widgets/URL_bottom_sheet/url_bottomsheet_viewmodel.dart';
import 'package:stacked/stacked.dart';

class URLBottomSheetView extends StatelessWidget {
final HomeViewBottomSheetMode? mode;
Expand Down Expand Up @@ -73,8 +73,8 @@ class URLBottomSheetView extends StatelessWidget {
borderRadius: BorderRadius.circular(5.0),
side: BorderSide(color: Theme.of(context).primaryColor),
),
side: BorderSide(color: Theme.of(context).primaryColor),
primary: Theme.of(context).primaryColor),
backgroundColor: Theme.of(context).primaryColor,
side: BorderSide(color: Theme.of(context).primaryColor)),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 28, vertical: 16),
Expand Down Expand Up @@ -106,8 +106,9 @@ class URLBottomSheetView extends StatelessWidget {
side:
BorderSide(color: Theme.of(context).primaryColor),
),
side: BorderSide(color: Theme.of(context).primaryColor),
primary: Theme.of(context).primaryColor),
backgroundColor: Theme.of(context).primaryColor,
side:
BorderSide(color: Theme.of(context).primaryColor)),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 28, vertical: 16),
Expand Down