Skip to content
Snippets Groups Projects
Commit a9103e41 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '27-normalize-activity-application-architecture' into 'master'

Resolve "Normalize Activity application architecture"

Closes #27

See merge request !26
parents 9a00a297 fea53d84
No related branches found
No related tags found
1 merge request!26Resolve "Normalize Activity application architecture"
Pipeline #6787 passed
Showing
with 253 additions and 198 deletions
{ {
"app_name": "Reversi", "app_name": "Reversi",
"page_home": "Home",
"page_game": "Game",
"settings_title": "Settings", "settings_title": "Settings",
"settings_label_theme": "Theme mode", "settings_label_theme": "Theme mode",
......
{ {
"app_name": "Reversi", "app_name": "Reversi",
"page_home": "Accueil",
"page_game": "Jeu",
"settings_title": "Réglages", "settings_title": "Réglages",
"settings_label_theme": "Thème de couleurs", "settings_label_theme": "Thème de couleurs",
......
Normalize Activity application architecture.
Harmonisation des applications en Activity.
#! /bin/bash
# Check dependencies
command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; }
command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not installed. Aborting."; exit 1; }
command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; }
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
SOURCE_ICON="${CURRENT_DIR}/icon.svg"
SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg"
SOURCE_LAUNCH_IMAGE="${CURRENT_DIR}/icon.svg"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
if [ ! -f "${SOURCE_ICON}" ]; then
echo "Missing file: ${SOURCE_ICON}"
fi
if [ ! -f "${SOURCE_FASTLANE}" ]; then
echo "Missing file: ${SOURCE_FASTLANE}"
fi
if [ ! -f "${SOURCE_LAUNCH_IMAGE}" ]; then
echo "Missing file: ${SOURCE_LAUNCH_IMAGE}"
fi
function optimize_svg() {
SVG="$1"
cp ${SVG} ${SVG}.tmp
scour \
--remove-descriptive-elements \
--enable-id-stripping \
--enable-viewboxing \
--enable-comment-stripping \
--nindent=4 \
--quiet \
-i ${SVG}.tmp \
-o ${SVG}
rm ${SVG}.tmp
}
# optimize source svg files
optimize_svg ${SOURCE_ICON}
optimize_svg ${SOURCE_FASTLANE}
optimize_svg ${SOURCE_LAUNCH_IMAGE}
# build icons
function build_application_icon() {
ICON_SIZE="$1"
TARGET="$2"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE_ICON}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
# build fastlane image
function build_fastlane_image() {
WIDTH="$1"
HEIGHT="$2"
TARGET="$3"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${WIDTH} \
--export-height=${HEIGHT} \
--export-filename=${TARGET_PNG} \
${SOURCE_FASTLANE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
# build launch images (splash screen)
function build_launch_image() {
ICON_SIZE="$1"
TARGET="$2"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE_LAUNCH_IMAGE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
build_application_icon 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/ic_launcher
build_application_icon 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/ic_launcher
build_application_icon 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/ic_launcher
build_application_icon 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher
build_application_icon 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher
build_application_icon 512 ${BASE_DIR}/fastlane/metadata/android/en-US/images/icon
build_launch_image 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/launch_image
build_launch_image 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/launch_image
build_launch_image 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/launch_image
build_launch_image 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/launch_image
build_launch_image 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/launch_image
build_fastlane_image 1024 500 ${BASE_DIR}/fastlane/metadata/android/en-US/images/featureGraphic
#! /bin/bash
# Check dependencies
command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; }
command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not installed. Aborting."; exit 1; }
command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; }
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
SOURCE="${CURRENT_DIR}/icon.svg"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
# optimize svg
cp ${SOURCE} ${SOURCE}.tmp
scour \
--remove-descriptive-elements \
--enable-id-stripping \
--enable-viewboxing \
--enable-comment-stripping \
--nindent=4 \
-i ${SOURCE}.tmp \
-o ${SOURCE}
rm ${SOURCE}.tmp
# build icons
function build_icon() {
ICON_SIZE="$1"
TARGET="$2"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
build_icon 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/ic_launcher
build_icon 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/ic_launcher
build_icon 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/ic_launcher
build_icon 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher
build_icon 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher
build_icon 512 ${BASE_DIR}/fastlane/metadata/android/en-US/images/icon
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path transform="matrix(1.3783 .61747 -.61747 1.3783 45.198 93.762)" d="m11.645-14.603-44.77-4.6003 26.369-36.472z" fill="#fff" stroke="#950e4f" stroke-linecap="round" stroke-linejoin="round" stroke-width="7.2832"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="m76.652 23.303-3.6441 58.302c-0.28153 4.5103-4.0223 8.0241-8.5413 8.0241h-35.27c-4.5189 0-8.2598-3.5138-8.5413-8.0241l-3.6441-58.302h-5.4824c-1.7723 0-3.2093-1.437-3.2093-3.2093 0-1.773 1.437-3.2093 3.2093-3.2093h70.605c1.7723 0 3.2093 1.4363 3.2093 3.2093 0 1.7723-1.437 3.2093-3.2093 3.2093zm-6.8314 0h-45.979l3.0819 55.867c0.12535 2.268 2.0008 4.0433 4.2732 4.0433h31.268c2.2724 0 4.1478-1.7752 4.2732-4.0433zm-22.99 6.4188c1.6541 0 2.9952 1.3411 2.9952 2.9952v41.08c0 1.6541-1.3411 2.9952-2.9952 2.9952-1.6542 0-2.9952-1.3411-2.9952-2.9952v-41.08c0-1.6541 1.3411-2.9952 2.9952-2.9952zm-12.837 0c1.6756 0 3.0553 1.3181 3.1312 2.9921l1.8776 41.3c0.06665 1.4664-1.0681 2.7087-2.5345 2.7762-0.04011 0.0015-0.08024 0.0021-0.12108 0.0021-1.5595 0-2.8476-1.2193-2.9328-2.7774l-2.253-41.3c-0.08524-1.5646 1.114-2.9012 2.6779-2.9864 0.05157-0.0029 0.10317-0.0042 0.15474-0.0042zm25.675 0c1.5667 0 2.8361 1.2694 2.8361 2.8361 0 0.05156-6.87e-4 0.10317-0.0036 0.15474l-2.2416 41.088c-0.09171 1.6778-1.4786 2.991-3.1586 2.991-1.5667 0-2.8361-1.2694-2.8361-2.8361 0-0.05156 7.31e-4 -0.10315 0.0036-0.15474l2.2417-41.088c0.09172-1.6778 1.4786-2.991 3.1586-2.991zm-21.397-25.675h17.117c4.7265 0 8.5578 3.8313 8.5578 8.5578v4.2795h-34.231v-4.2795c0-4.7265 3.8313-8.5578 8.5578-8.5578zm0.42837 6.4188c-1.4184 0-2.5675 1.1491-2.5675 2.5675v3.8512h21.394v-3.8512c0-1.4184-1.1491-2.5675-2.5675-2.5675z" fill="#fff" fill-rule="evenodd" stroke="#050200"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x=".44662" y=".89101" width="92.772" height="91.894" ry="11.689" fill="#ee494c" stroke="#fff" stroke-width=".238"/><g fill="#fffefe" stroke="#a11010" stroke-width="4"><path d="m42.177 75.882-12.716 3.8216c-1.7371 0.48639-3.5437-0.48639-4.0996-2.154-0.48639-1.7371 0.48639-3.5437 2.154-4.0996l4.7249-1.3897c-8.616-5.0723-14.453-14.453-14.453-25.223 0-12.021 7.3653-22.374 17.788-26.821 2.154-0.90329 4.5859 0.69484 4.5859 2.9878 0 1.3202-0.76432 2.5014-1.9456 2.9878-8.1991 3.4742-13.897 11.465-13.897 20.845 0 8.477 4.7249 15.912 11.673 19.733l-1.6676-5.6282c-0.48639-1.7371 0.48639-3.5437 2.154-4.0996 1.7371-0.48639 3.5437 0.48639 4.0996 2.154l3.8216 12.716c0.48639 1.8066-0.48639 3.6132-2.2235 4.169z"/><path d="m66.079 20.226-4.7249 1.3897c8.6855 5.0723 14.522 14.453 14.522 25.223 0 12.021-7.3653 22.374-17.788 26.821-2.154 0.90329-4.5859-0.69484-4.5859-2.9878 0-1.3202 0.76432-2.5014 1.9456-2.9878 8.1991-3.4742 13.897-11.465 13.897-20.845 0-8.477-4.7249-15.912-11.673-19.733l1.6676 5.6282c0.48639 1.7371-0.48639 3.5437-2.154 4.0996-1.7371 0.48639-3.5437-0.48639-4.0996-2.154l-3.8216-12.716c-0.48639-1.7371 0.48639-3.5437 2.2235-4.0996l12.716-3.8911c1.7371-0.48639 3.5437 0.48639 4.0996 2.154 0.48639 1.7371-0.48639 3.6132-2.2235 4.0996z"/></g>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-5.618)" fill="#fff" stroke="#105ea2" stroke-linecap="round" stroke-linejoin="round"><path transform="matrix(-1.3783 -.61747 .61747 -1.3783 55.567 -.086035)" d="m11.645-14.603-44.77-4.6003 26.369-36.472z" stroke-width="7.2832"/><path d="m15.535 12.852 2e-3 67.973z" stroke-width="11"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path transform="matrix(-1.3783 -.61747 .61747 -1.3783 46.954 -.086035)" d="m11.645-14.603-44.77-4.6003 26.369-36.472z" fill="#fff" stroke="#105ea2" stroke-linecap="round" stroke-linejoin="round" stroke-width="7.2832"/></svg>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:reversi/models/game/game_board.dart'; import 'package:reversi/models/activity/game_board.dart';
class GameBoardScorer { class GameBoardScorer {
// Values for each position on the board. // Values for each position on the board.
......
...@@ -7,7 +7,7 @@ import 'dart:async'; ...@@ -7,7 +7,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:reversi/ai/game_board_scorer.dart'; import 'package:reversi/ai/game_board_scorer.dart';
import 'package:reversi/models/game/game_board.dart'; import 'package:reversi/models/activity/game_board.dart';
class MoveSearchArgs { class MoveSearchArgs {
MoveSearchArgs({required this.board, required this.player, required this.numPlies}); MoveSearchArgs({required this.board, required this.player, required this.numPlies});
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:reversi/ui/screens/page_about.dart'; import 'package:reversi/common/ui/pages/game.dart';
import 'package:reversi/ui/screens/page_game.dart'; import 'package:reversi/common/ui/pages/parameters.dart';
import 'package:reversi/ui/screens/page_settings.dart';
class MenuItem { class ActivityPageItem {
final String code;
final Icon icon; final Icon icon;
final Widget page; final Widget page;
const MenuItem({ const ActivityPageItem({
required this.code,
required this.icon, required this.icon,
required this.page, required this.page,
}); });
} }
class Menu { class ActivityPage {
static const indexGame = 0; static const bool displayBottomNavBar = false;
static const menuItemGame = MenuItem(
icon: Icon(UniconsLine.home),
page: PageGame(),
);
static const indexSettings = 1; static const indexHome = 0;
static const menuItemSettings = MenuItem( static const pageHome = ActivityPageItem(
icon: Icon(UniconsLine.setting), code: 'page_home',
page: PageSettings(), icon: Icon(UniconsLine.home),
page: PageParameters(),
); );
static const indexAbout = 2; static const indexGame = 1;
static const menuItemAbout = MenuItem( static const pageGame = ActivityPageItem(
icon: Icon(UniconsLine.info_circle), code: 'page_game',
page: PageAbout(), icon: Icon(UniconsLine.star),
page: PageGame(),
); );
static Map<int, MenuItem> items = { static const Map<int, ActivityPageItem> items = {
indexGame: menuItemGame, indexHome: pageHome,
indexSettings: menuItemSettings, indexGame: pageGame,
indexAbout: menuItemAbout,
}; };
static int defaultPageIndex = indexHome;
static bool isIndexAllowed(int pageIndex) { static bool isIndexAllowed(int pageIndex) {
return items.keys.contains(pageIndex); return items.keys.contains(pageIndex);
} }
static Widget getPageWidget(int pageIndex) { static Widget getWidget(int pageIndex) {
return items[pageIndex]?.page ?? menuItemGame.page; return items[pageIndex]?.page ?? pageHome.page;
} }
static int itemsCount = Menu.items.length;
} }
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:reversi/common/ui/screens/about.dart';
import 'package:reversi/common/ui/screens/activity.dart';
import 'package:reversi/common/ui/screens/settings.dart';
class ScreenItem {
final String code;
final Icon icon;
final Widget screen;
const ScreenItem({
required this.code,
required this.icon,
required this.screen,
});
}
class Screen {
static const indexActivity = 0;
static const screenActivity = ScreenItem(
code: 'screen_activity',
icon: Icon(UniconsLine.home),
screen: ScreenActivity(),
);
static const indexSettings = 1;
static const screenSettings = ScreenItem(
code: 'screen_settings',
icon: Icon(UniconsLine.setting),
screen: ScreenSettings(),
);
static const indexAbout = 2;
static const screenAbout = ScreenItem(
code: 'screen_about',
icon: Icon(UniconsLine.info_circle),
screen: ScreenAbout(),
);
static Map<int, ScreenItem> items = {
indexActivity: screenActivity,
indexSettings: screenSettings,
indexAbout: screenAbout,
};
static bool isIndexAllowed(int screenIndex) {
return items.keys.contains(screenIndex);
}
static Widget getWidget(int screenIndex) {
return items[screenIndex]?.screen ?? screenActivity.screen;
}
}
import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:reversi/config/menu.dart'; import 'package:reversi/common/config/activity_page.dart';
class NavCubit extends HydratedCubit<int> { class NavCubitPage extends HydratedCubit<int> {
NavCubit() : super(0); NavCubitPage() : super(0);
void updateIndex(int index) { void updateIndex(int index) {
if (Menu.isIndexAllowed(index)) { if (ActivityPage.isIndexAllowed(index)) {
emit(index); emit(index);
} else { } else {
goToGamePage(); emit(ActivityPage.indexHome);
} }
} }
void goToGamePage() { void goToPageHome() {
emit(Menu.indexGame); updateIndex(ActivityPage.indexHome);
} }
void goToSettingsPage() { void goToPageGame() {
emit(Menu.indexSettings); updateIndex(ActivityPage.indexGame);
}
void goToAboutPage() {
emit(Menu.indexAbout);
} }
@override @override
int fromJson(Map<String, dynamic> json) { int fromJson(Map<String, dynamic> json) {
return Menu.indexGame; return ActivityPage.indexHome;
} }
@override @override
Map<String, dynamic>? toJson(int state) { Map<String, dynamic>? toJson(int state) {
return <String, int>{'pageIndex': state}; return <String, int>{'index': state};
} }
} }
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:reversi/common/config/screen.dart';
class NavCubitScreen extends HydratedCubit<int> {
NavCubitScreen() : super(0);
void updateIndex(int index) {
if (Screen.isIndexAllowed(index)) {
emit(index);
} else {
goToScreenActivity();
}
}
void goToScreenActivity() {
emit(Screen.indexActivity);
}
void goToScreenSettings() {
emit(Screen.indexSettings);
}
void goToScreenAbout() {
emit(Screen.indexAbout);
}
@override
int fromJson(Map<String, dynamic> json) {
return Screen.indexActivity;
}
@override
Map<String, dynamic>? toJson(int state) {
return <String, int>{'index': state};
}
}
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:reversi/common/config/activity_page.dart';
import 'package:reversi/common/cubit/nav/nav_cubit_pages.dart';
class BottomNavBar extends StatelessWidget {
const BottomNavBar({super.key});
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.only(top: 1, right: 4, left: 4),
elevation: 4,
shadowColor: Theme.of(context).colorScheme.shadow,
color: Theme.of(context).colorScheme.surfaceContainerHighest,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
),
child: BlocBuilder<NavCubitPage, int>(builder: (BuildContext context, int state) {
final List<BottomNavigationBarItem> items = [];
ActivityPage.items.forEach((int pageIndex, ActivityPageItem item) {
items.add(BottomNavigationBarItem(
icon: item.icon,
label: tr(item.code),
));
});
return BottomNavigationBar(
currentIndex: state,
onTap: (int index) => BlocProvider.of<NavCubitPage>(context).updateIndex(index),
type: BottomNavigationBarType.fixed,
elevation: 0,
backgroundColor: Colors.transparent,
selectedItemColor: Theme.of(context).colorScheme.primary,
unselectedItemColor: Theme.of(context).textTheme.bodySmall!.color,
items: items,
);
}),
);
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:reversi/config/menu.dart'; import 'package:reversi/common/config/screen.dart';
import 'package:reversi/cubit/game_cubit.dart'; import 'package:reversi/common/cubit/nav/nav_cubit_pages.dart';
import 'package:reversi/cubit/nav_cubit.dart'; import 'package:reversi/common/cubit/nav/nav_cubit_screens.dart';
import 'package:reversi/models/game/game.dart';
import 'package:reversi/cubit/activity/activity_cubit.dart';
import 'package:reversi/models/activity/activity.dart';
class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget {
const GlobalAppBar({super.key}); const GlobalAppBar({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<GameCubit, GameState>( return BlocBuilder<ActivityCubit, ActivityState>(
builder: (BuildContext context, GameState gameState) { builder: (BuildContext context, ActivityState activityState) {
return BlocBuilder<NavCubit, int>( return BlocBuilder<NavCubitScreen, int>(
builder: (BuildContext context, int pageIndex) { builder: (BuildContext context, int pageIndex) {
final Game currentGame = gameState.currentGame; final Activity currentActivity = activityState.currentActivity;
final List<Widget> menuActions = []; final List<Widget> menuActions = [];
if (currentGame.isRunning && !currentGame.isFinished) { if (currentActivity.isRunning && !currentActivity.isFinished) {
menuActions.add(StyledButton( menuActions.add(StyledButton(
color: Colors.red, color: Colors.red,
onPressed: () {}, onPressed: () {},
onLongPress: () { onLongPress: () {
BlocProvider.of<GameCubit>(context).quitGame(); BlocProvider.of<ActivityCubit>(context).quitActivity();
BlocProvider.of<NavCubitPage>(context).goToPageHome();
}, },
child: const Image( child: const Image(
image: AssetImage('assets/ui/button_back.png'), image: AssetImage('assets/ui/button_back.png'),
...@@ -32,38 +35,38 @@ class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { ...@@ -32,38 +35,38 @@ class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget {
), ),
)); ));
} else { } else {
if (pageIndex == Menu.indexGame) { if (pageIndex == Screen.indexActivity) {
// go to Settings page // go to Settings page
menuActions.add(ElevatedButton( menuActions.add(ElevatedButton(
onPressed: () { onPressed: () {
BlocProvider.of<NavCubit>(context).goToSettingsPage(); BlocProvider.of<NavCubitScreen>(context).goToScreenSettings();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: const CircleBorder(), shape: const CircleBorder(),
), ),
child: Menu.menuItemSettings.icon, child: Screen.screenSettings.icon,
)); ));
// go to About page // go to About page
menuActions.add(ElevatedButton( menuActions.add(ElevatedButton(
onPressed: () { onPressed: () {
BlocProvider.of<NavCubit>(context).goToAboutPage(); BlocProvider.of<NavCubitScreen>(context).goToScreenAbout();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: const CircleBorder(), shape: const CircleBorder(),
), ),
child: Menu.menuItemAbout.icon, child: Screen.screenAbout.icon,
)); ));
} else { } else {
// back to Home page // back to Home page
menuActions.add(ElevatedButton( menuActions.add(ElevatedButton(
onPressed: () { onPressed: () {
BlocProvider.of<NavCubit>(context).goToGamePage(); BlocProvider.of<NavCubitScreen>(context).goToScreenActivity();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: const CircleBorder(), shape: const CircleBorder(),
), ),
child: Menu.menuItemGame.icon, child: Screen.screenActivity.icon,
)); ));
} }
} }
......
...@@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; ...@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:reversi/ui/widgets/game/game_board.dart'; import 'package:reversi/ui/widgets/game/game_board.dart';
class GameLayout extends StatelessWidget { class PageGame extends StatelessWidget {
const GameLayout({super.key}); const PageGame({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment