Skip to content

Commit

Permalink
Merge pull request VaibhavCodeClub#160 from Maheen-Ilyas/version-update
Browse files Browse the repository at this point in the history
Replaced MaterialStateProperty to WidgetStateProperty
  • Loading branch information
sapatevaibhav authored May 31, 2024
2 parents ee1acab + 096b03a commit eabcec2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/pages/fruits.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class _FruitsPageState extends State<FruitsPage> {
),
ElevatedButton(
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(
fixedSize: WidgetStateProperty.all(
Size(MediaQuery.of(context).size.width * .3, 50))),
onPressed: () {
if (AppConstants.Fruits[_currentIndex].isfruit == true) {
Expand All @@ -131,7 +131,7 @@ class _FruitsPageState extends State<FruitsPage> {
),
ElevatedButton(
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(
fixedSize: WidgetStateProperty.all(
Size(MediaQuery.of(context).size.width * .3, 50))),
onPressed: () {
if (AppConstants.Fruits[_currentIndex].isfruit == false) {
Expand Down
13 changes: 8 additions & 5 deletions lib/pages/main_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:learn/widgets/navbar/navbar.dart';

class MainHome extends StatefulWidget {
final AdaptiveThemeMode? savedThemeMode;

const MainHome({
super.key,
this.savedThemeMode,
Expand All @@ -22,7 +23,7 @@ class MainHome extends StatefulWidget {
}

class _MainHomeState extends State<MainHome> {
Future<bool> _onBackPressed() {
bool _onBackPressed(bool canPop) {
DateTime now = DateTime.now();
if (currentBackPressTime == null ||
now.difference(currentBackPressTime!) > const Duration(seconds: 2)) {
Expand All @@ -32,15 +33,17 @@ class _MainHomeState extends State<MainHome> {
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
);
return Future.value(false);
canPop = false;
} else {
canPop = true;
}
return Future.value(true);
return canPop;
}

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onBackPressed,
return PopScope(
onPopInvoked: _onBackPressed,
child: AdaptiveTheme(
light: ThemeData.light(),
dark: ThemeData.dark(),
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/modules/atoz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class _PopupDialogState extends State<_PopupDialog> {
const SizedBox(height: ConstantDimensions.heightMedium),
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
backgroundColor: WidgetStateProperty.all(
const Color.fromARGB(216, 233, 101, 92),
),
),
Expand Down Expand Up @@ -270,8 +270,8 @@ class _AtoZState extends State<AtoZ> {
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: isTimerEnabled
? MaterialStateProperty.all(Colors.green)
: MaterialStateProperty.all(Colors.red),
? WidgetStateProperty.all(Colors.green)
: WidgetStateProperty.all(Colors.red),
),
onPressed: () {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/modules/seasons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class _SeasonPopupState extends State<SeasonPopup> {
),
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.red),
backgroundColor: WidgetStateProperty.all(Colors.red),
),
onPressed: () {
Navigator.of(context).pop();
Expand Down

0 comments on commit eabcec2

Please sign in to comment.