Replace icons to microsoft/fluentui-system-icons

This commit is contained in:
Calcitem 2021-07-18 22:23:55 +08:00
parent 3caccf1cb1
commit 6b6b2f74ce
No known key found for this signature in database
GPG Key ID: F2F7C29E054CFB80
5 changed files with 83 additions and 44 deletions

View File

@ -20,6 +20,7 @@ import 'dart:async';
//import 'dart:typed_data';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:sanmill/common/config.dart';
@ -1258,21 +1259,25 @@ class _GamePageState extends State<GamePage>
Widget createPageHeader() {
Map<EngineType, IconData> engineTypeToIconLeft = {
EngineType.humanVsAi: Config.aiMovesFirst ? Icons.computer : Icons.person,
EngineType.humanVsHuman: Icons.person,
EngineType.aiVsAi: Icons.computer,
EngineType.humanVsCloud: Icons.person,
EngineType.humanVsLAN: Icons.person,
EngineType.testViaLAN: Icons.cast,
EngineType.humanVsAi: Config.aiMovesFirst
? FluentIcons.bot_24_regular
: FluentIcons.person_24_regular,
EngineType.humanVsHuman: FluentIcons.person_24_regular,
EngineType.aiVsAi: FluentIcons.bot_24_regular,
EngineType.humanVsCloud: FluentIcons.person_24_regular,
EngineType.humanVsLAN: FluentIcons.person_24_regular,
EngineType.testViaLAN: FluentIcons.wifi_1_24_regular,
};
Map<EngineType, IconData> engineTypeToIconRight = {
EngineType.humanVsAi: Config.aiMovesFirst ? Icons.person : Icons.computer,
EngineType.humanVsHuman: Icons.person,
EngineType.aiVsAi: Icons.computer,
EngineType.humanVsCloud: Icons.cloud,
EngineType.humanVsLAN: Icons.cast,
EngineType.testViaLAN: Icons.cast,
EngineType.humanVsAi: Config.aiMovesFirst
? FluentIcons.person_24_regular
: FluentIcons.bot_24_regular,
EngineType.humanVsHuman: FluentIcons.person_24_regular,
EngineType.aiVsAi: FluentIcons.bot_24_regular,
EngineType.humanVsCloud: FluentIcons.cloud_24_regular,
EngineType.humanVsLAN: FluentIcons.wifi_1_24_regular,
EngineType.testViaLAN: FluentIcons.wifi_1_24_regular,
};
IconData iconArrow = getIconArrow();
@ -1318,34 +1323,38 @@ class _GamePageState extends State<GamePage>
}
IconData getIconArrow() {
IconData iconArrow = Icons.code;
IconData iconArrow = FluentIcons.code_24_regular;
if (Game.instance.position.phase == Phase.gameOver) {
switch (Game.instance.position.winner) {
case PieceColor.white:
iconArrow =
ltr ? Icons.toggle_off_outlined : Icons.toggle_on_outlined;
iconArrow = ltr
? FluentIcons.thumb_dislike_24_regular
: FluentIcons.thumb_like_24_regular;
break;
case PieceColor.black:
iconArrow =
ltr ? Icons.toggle_on_outlined : Icons.toggle_off_outlined;
iconArrow = ltr
? FluentIcons.thumb_like_24_regular
: FluentIcons.thumb_dislike_24_regular;
break;
default:
iconArrow = Icons.view_agenda;
iconArrow = FluentIcons.handshake_24_regular;
break;
}
} else {
switch (Game.instance.sideToMove) {
case PieceColor.white:
iconArrow =
ltr ? Icons.keyboard_arrow_left : Icons.keyboard_arrow_right;
iconArrow = ltr
? FluentIcons.chevron_left_24_regular
: FluentIcons.chevron_right_24_regular;
break;
case PieceColor.black:
iconArrow =
ltr ? Icons.keyboard_arrow_right : Icons.keyboard_arrow_left;
iconArrow = ltr
? FluentIcons.chevron_right_24_regular
: FluentIcons.chevron_left_24_regular;
break;
default:
iconArrow = Icons.code;
iconArrow = FluentIcons.code_24_regular;
break;
}
}
@ -1420,7 +1429,7 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
Icons.casino_outlined,
FluentIcons.board_24_regular,
color: AppTheme.toolbarIconColor,
),
Text(S.of(context).game,
@ -1435,7 +1444,7 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
Icons.room_preferences_outlined,
FluentIcons.settings_24_regular,
color: AppTheme.toolbarIconColor,
),
Text(S.of(context).options,
@ -1450,7 +1459,7 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
Icons.list_alt,
FluentIcons.calendar_agenda_24_regular,
color: AppTheme.toolbarIconColor,
),
Text(S.of(context).move,
@ -1465,7 +1474,7 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
Icons.lightbulb_outline,
FluentIcons.lightbulb_24_regular,
color: AppTheme.toolbarIconColor,
),
Text(S.of(context).info,
@ -1502,7 +1511,9 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
ltr ? Icons.first_page : Icons.last_page,
ltr
? FluentIcons.arrow_previous_24_regular
: FluentIcons.arrow_next_24_regular,
color: AppTheme.toolbarIconColor,
),
],
@ -1515,7 +1526,7 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
Icons.keyboard_arrow_left,
FluentIcons.chevron_left_24_regular,
color: AppTheme.toolbarIconColor,
),
],
@ -1528,7 +1539,7 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
Icons.keyboard_arrow_right,
FluentIcons.chevron_right_24_regular,
color: AppTheme.toolbarIconColor,
),
],
@ -1541,7 +1552,9 @@ class _GamePageState extends State<GamePage>
// Replace with a Row for horizontal icon + text
children: <Widget>[
Icon(
ltr ? Icons.last_page : Icons.first_page,
ltr
? FluentIcons.arrow_next_24_regular
: FluentIcons.arrow_previous_24_regular,
color: AppTheme.toolbarIconColor,
),
],

View File

@ -19,6 +19,7 @@
import 'dart:async';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:sanmill/common/config.dart';
import 'package:sanmill/common/constants.dart';
@ -79,47 +80,47 @@ class _HomeDrawerState extends State<HomeDrawer> {
DrawerListItem(
index: DrawerIndex.humanVsAi,
title: S.of(context).humanVsAi,
icon: Icon(Icons.person_outline),
icon: Icon(FluentIcons.person_24_regular),
),
DrawerListItem(
index: DrawerIndex.humanVsHuman,
title: S.of(context).humanVsHuman,
icon: Icon(Icons.people_outline),
icon: Icon(FluentIcons.people_24_regular),
),
DrawerListItem(
index: DrawerIndex.aiVsAi,
title: S.of(context).aiVsAi,
icon: Icon(Icons.computer),
icon: Icon(FluentIcons.bot_24_regular),
),
DrawerListItem(
index: DrawerIndex.preferences,
title: S.of(context).preferences,
icon: Icon(Icons.settings_outlined),
icon: Icon(FluentIcons.options_24_regular),
),
DrawerListItem(
index: DrawerIndex.ruleSettings,
title: S.of(context).ruleSettings,
icon: Icon(Icons.rule),
icon: Icon(FluentIcons.task_list_ltr_24_regular),
),
DrawerListItem(
index: DrawerIndex.personalization,
title: S.of(context).personalization,
icon: Icon(Icons.color_lens_outlined),
icon: Icon(FluentIcons.design_ideas_24_regular),
),
DrawerListItem(
index: DrawerIndex.feedback,
title: S.of(context).feedback,
icon: Icon(Icons.feedback_outlined),
icon: Icon(FluentIcons.person_feedback_24_regular),
),
DrawerListItem(
index: DrawerIndex.Help,
title: S.of(context).help,
icon: Icon(Icons.help_outline),
icon: Icon(FluentIcons.question_circle_24_regular),
),
DrawerListItem(
index: DrawerIndex.About,
title: S.of(context).about,
icon: Icon(Icons.info_outline),
icon: Icon(FluentIcons.info_24_regular),
),
];
@ -184,7 +185,8 @@ class _HomeDrawerState extends State<HomeDrawer> {
children: <Widget>[
animatedBuilder,
Padding(
padding: EdgeInsets.only(top: (isLargeScreen() ? 30 : 8), left: 4),
padding:
EdgeInsets.only(top: (isLargeScreen() ? 30 : 8), left: 4),
child: animatedTextKit,
),
],
@ -204,7 +206,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
textAlign: TextAlign.left,
),
trailing: Icon(
Icons.power_settings_new,
FluentIcons.power_24_regular,
color: AppTheme.exitIconColor,
),
onTap: () async {

View File

@ -1,3 +1,22 @@
/*
This file is part of Sanmill.
Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
Sanmill is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Sanmill is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:sanmill/generated/l10n.dart';
@ -63,7 +82,7 @@ class OssLicensesPage extends StatelessWidget {
return ListTile(
title: Text('$key ${version ?? ''}'),
subtitle: desc != null ? Text(desc) : null,
trailing: Icon(Icons.chevron_right),
trailing: Icon(FluentIcons.chevron_right_24_regular),
onTap: () => Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
MiscOssLicenseSingle(name: key, json: ossl))));

View File

@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:sanmill/common/config.dart';
import 'package:sanmill/l10n/resources.dart';
@ -72,7 +73,10 @@ class SettingsListTile extends StatelessWidget {
trailingColor == null ? null : Color(trailingColor!),
),
),
Icon(ltr ? Icons.keyboard_arrow_right : Icons.keyboard_arrow_left,
Icon(
ltr
? FluentIcons.chevron_right_24_regular
: FluentIcons.chevron_left_24_regular,
color: AppTheme.listTileSubtitleColor)
],
),

View File

@ -31,6 +31,7 @@ dependencies:
animated_text_kit: ^4.1.1
flutter_colorpicker: ^0.4.0
device_info_plus_platform_interface: ^2.1.0
fluentui_system_icons: ^1.1.134
#pref: ^2.3.0
#screen_recorder: ^0.0.2