From 6b6b2f74cea48972ecff2c0f887f6b2128e52e59 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 18 Jul 2021 22:23:55 +0800 Subject: [PATCH] Replace icons to microsoft/fluentui-system-icons --- src/ui/flutter_app/lib/widgets/game_page.dart | 75 +++++++++++-------- .../flutter_app/lib/widgets/home_drawer.dart | 24 +++--- .../lib/widgets/oss_license_page.dart | 21 +++++- .../lib/widgets/settings_list_tile.dart | 6 +- src/ui/flutter_app/pubspec.yaml | 1 + 5 files changed, 83 insertions(+), 44 deletions(-) diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index eede453f..8f984fb1 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -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 Widget createPageHeader() { Map 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 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 } 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 // Replace with a Row for horizontal icon + text children: [ Icon( - Icons.casino_outlined, + FluentIcons.board_24_regular, color: AppTheme.toolbarIconColor, ), Text(S.of(context).game, @@ -1435,7 +1444,7 @@ class _GamePageState extends State // Replace with a Row for horizontal icon + text children: [ 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 // Replace with a Row for horizontal icon + text children: [ 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 // Replace with a Row for horizontal icon + text children: [ Icon( - Icons.lightbulb_outline, + FluentIcons.lightbulb_24_regular, color: AppTheme.toolbarIconColor, ), Text(S.of(context).info, @@ -1502,7 +1511,9 @@ class _GamePageState extends State // Replace with a Row for horizontal icon + text children: [ 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 // Replace with a Row for horizontal icon + text children: [ Icon( - Icons.keyboard_arrow_left, + FluentIcons.chevron_left_24_regular, color: AppTheme.toolbarIconColor, ), ], @@ -1528,7 +1539,7 @@ class _GamePageState extends State // Replace with a Row for horizontal icon + text children: [ Icon( - Icons.keyboard_arrow_right, + FluentIcons.chevron_right_24_regular, color: AppTheme.toolbarIconColor, ), ], @@ -1541,7 +1552,9 @@ class _GamePageState extends State // Replace with a Row for horizontal icon + text children: [ Icon( - ltr ? Icons.last_page : Icons.first_page, + ltr + ? FluentIcons.arrow_next_24_regular + : FluentIcons.arrow_previous_24_regular, color: AppTheme.toolbarIconColor, ), ], diff --git a/src/ui/flutter_app/lib/widgets/home_drawer.dart b/src/ui/flutter_app/lib/widgets/home_drawer.dart index b243310a..5c32092a 100644 --- a/src/ui/flutter_app/lib/widgets/home_drawer.dart +++ b/src/ui/flutter_app/lib/widgets/home_drawer.dart @@ -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 { 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 { children: [ 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 { textAlign: TextAlign.left, ), trailing: Icon( - Icons.power_settings_new, + FluentIcons.power_24_regular, color: AppTheme.exitIconColor, ), onTap: () async { diff --git a/src/ui/flutter_app/lib/widgets/oss_license_page.dart b/src/ui/flutter_app/lib/widgets/oss_license_page.dart index 5b33b8f4..faad7492 100644 --- a/src/ui/flutter_app/lib/widgets/oss_license_page.dart +++ b/src/ui/flutter_app/lib/widgets/oss_license_page.dart @@ -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 . +*/ + +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)))); diff --git a/src/ui/flutter_app/lib/widgets/settings_list_tile.dart b/src/ui/flutter_app/lib/widgets/settings_list_tile.dart index 1c36b890..f245d53c 100644 --- a/src/ui/flutter_app/lib/widgets/settings_list_tile.dart +++ b/src/ui/flutter_app/lib/widgets/settings_list_tile.dart @@ -16,6 +16,7 @@ along with this program. If not, see . */ +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) ], ), diff --git a/src/ui/flutter_app/pubspec.yaml b/src/ui/flutter_app/pubspec.yaml index e883fdf0..03a54328 100644 --- a/src/ui/flutter_app/pubspec.yaml +++ b/src/ui/flutter_app/pubspec.yaml @@ -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