fix drawer icon color
the drawer icon will now follow the nearest IconThemeData. Only the gamePage nad helPage do override them. cleanup code
This commit is contained in:
parent
f993e975fe
commit
233bf10694
|
@ -22,7 +22,6 @@ import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:sanmill/generated/intl/l10n.dart';
|
import 'package:sanmill/generated/intl/l10n.dart';
|
||||||
import 'package:sanmill/main.dart';
|
|
||||||
import 'package:sanmill/mill/game.dart';
|
import 'package:sanmill/mill/game.dart';
|
||||||
import 'package:sanmill/mill/position.dart';
|
import 'package:sanmill/mill/position.dart';
|
||||||
import 'package:sanmill/mill/rule.dart';
|
import 'package:sanmill/mill/rule.dart';
|
||||||
|
@ -1346,39 +1345,30 @@ class _GamePageState extends State<GamePage>
|
||||||
}
|
}
|
||||||
|
|
||||||
IconData get iconArrow {
|
IconData get iconArrow {
|
||||||
IconData iconArrow = FluentIcons.code_24_regular;
|
|
||||||
|
|
||||||
if (gameInstance.position.phase == Phase.gameOver) {
|
if (gameInstance.position.phase == Phase.gameOver) {
|
||||||
switch (gameInstance.position.winner) {
|
switch (gameInstance.position.winner) {
|
||||||
case PieceColor.white:
|
case PieceColor.white:
|
||||||
iconArrow = ltr
|
return ltr
|
||||||
? FluentIcons.toggle_left_24_regular
|
? FluentIcons.toggle_left_24_regular
|
||||||
: FluentIcons.toggle_right_24_regular;
|
: FluentIcons.toggle_right_24_regular;
|
||||||
break;
|
|
||||||
case PieceColor.black:
|
case PieceColor.black:
|
||||||
iconArrow = ltr
|
return ltr
|
||||||
? FluentIcons.toggle_right_24_regular
|
? FluentIcons.toggle_right_24_regular
|
||||||
: FluentIcons.toggle_left_24_regular;
|
: FluentIcons.toggle_left_24_regular;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
iconArrow = FluentIcons.handshake_24_regular;
|
return FluentIcons.handshake_24_regular;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (gameInstance.sideToMove) {
|
switch (gameInstance.sideToMove) {
|
||||||
case PieceColor.white:
|
case PieceColor.white:
|
||||||
iconArrow = FluentIcons.chevron_left_24_regular;
|
return FluentIcons.chevron_left_24_regular;
|
||||||
break;
|
|
||||||
case PieceColor.black:
|
case PieceColor.black:
|
||||||
iconArrow = FluentIcons.chevron_right_24_regular;
|
return FluentIcons.chevron_right_24_regular;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
iconArrow = FluentIcons.code_24_regular;
|
return FluentIcons.code_24_regular;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iconArrow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget get board {
|
Widget get board {
|
||||||
|
@ -1645,10 +1635,6 @@ class _GamePageState extends State<GamePage>
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
routeObserver.subscribe(
|
|
||||||
this,
|
|
||||||
ModalRoute.of(context)! as PageRoute<dynamic>,
|
|
||||||
);
|
|
||||||
screenPaddingH = _screenPaddingH;
|
screenPaddingH = _screenPaddingH;
|
||||||
ltr = Directionality.of(context) == TextDirection.ltr;
|
ltr = Directionality.of(context) == TextDirection.ltr;
|
||||||
}
|
}
|
||||||
|
@ -1664,6 +1650,9 @@ class _GamePageState extends State<GamePage>
|
||||||
leading: DrawerIcon.of(context)?.icon,
|
leading: DrawerIcon.of(context)?.icon,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
|
iconTheme: IconThemeData(
|
||||||
|
color: AppTheme.drawerAnimationIconColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
backgroundColor: LocalDatabaseService.colorSettings.darkBackgroundColor,
|
backgroundColor: LocalDatabaseService.colorSettings.darkBackgroundColor,
|
||||||
|
@ -1688,7 +1677,6 @@ class _GamePageState extends State<GamePage>
|
||||||
disposed = true;
|
disposed = true;
|
||||||
_engine.shutdown();
|
_engine.shutdown();
|
||||||
_animationController.dispose();
|
_animationController.dispose();
|
||||||
routeObserver.unsubscribe(this);
|
|
||||||
LocalDatabaseService.listenPreferences.removeListener(_refeshEngine);
|
LocalDatabaseService.listenPreferences.removeListener(_refeshEngine);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@ class HelpScreen extends StatelessWidget {
|
||||||
color: AppTheme.helpTextColor,
|
color: AppTheme.helpTextColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
iconTheme: IconThemeData(
|
||||||
|
color: AppTheme.helpTextColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: LocalDatabaseService.colorSettings.darkBackgroundColor,
|
backgroundColor: LocalDatabaseService.colorSettings.darkBackgroundColor,
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
|
|
|
@ -126,7 +126,6 @@ class _CustomDrawerState extends State<CustomDrawer>
|
||||||
final _drawerOverlay = IconButton(
|
final _drawerOverlay = IconButton(
|
||||||
icon: AnimatedIcon(
|
icon: AnimatedIcon(
|
||||||
icon: AnimatedIcons.arrow_menu,
|
icon: AnimatedIcons.arrow_menu,
|
||||||
color: AppTheme.drawerAnimationIconColor,
|
|
||||||
progress: ReverseAnimation(_animationController),
|
progress: ReverseAnimation(_animationController),
|
||||||
),
|
),
|
||||||
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
|
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
|
||||||
|
|
Loading…
Reference in New Issue