Skip to content

Commit

Permalink
feat(ui): improve ui (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
NayMak authored Feb 21, 2022
1 parent 756f2b0 commit 869124b
Show file tree
Hide file tree
Showing 11 changed files with 1,173 additions and 242 deletions.
4 changes: 0 additions & 4 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
Expand Down
13 changes: 11 additions & 2 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:puzzle/bloc/bloc.dart';
import 'package:puzzle/services/shared.dart';
import 'package:puzzle/theme/theme.dart';
import 'package:puzzle/view/view.dart';
import 'package:go_router/go_router.dart';
Expand All @@ -16,15 +19,21 @@ class PuzzleApp extends StatelessWidget {
builder: (context) {
final _router = _buildRouter();

if (isMobile()) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
}

return MaterialApp.router(
routeInformationParser: _router.routeInformationParser,
routerDelegate: _router.routerDelegate,
onGenerateTitle: (context) => AppLocalizations.of(context)!.app_name,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
theme: ThemeData(
primarySwatch: xpehoGreen,
),
primarySwatch: xpehoGreen,
textTheme: GoogleFonts.aBeeZeeTextTheme(),
backgroundColor: Colors.white),
themeMode: ThemeMode.light,
);
},
);
Expand Down
38 changes: 21 additions & 17 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"app_name": "Puzzle",
"app_name": "Flutter Puzzle Hack",
"@app_name": {
"description": "Name of the application"
},
"shuffle": "Shuffle",
"@shuffle": {
"description": "Shuffle button label"
"company_name": "XPEHO",
"@company_name": {
"description": "Company name"
},
"complexity": "Complexity {complexityValue}",
"@complexity": {
Expand All @@ -17,15 +17,7 @@
}
}
},
"solve": "Solve",
"@solve": {
"description": "Solve button label"
},
"team_name": "Xpeho mobile",
"@team_name": {
"description": "Team name"
},
"moves": "Moves {count}",
"moves": "Moves: {count}",
"@moves": {
"description": "Moves label",
"placeholders": {
Expand All @@ -39,10 +31,6 @@
"@play": {
"description": "Play button label"
},
"victory_title": "You win !",
"@victory_title": {
"description": "Victory title"
},
"restart_btn": "Restart",
"@restart_btn": {
"description": "Restart button label"
Expand All @@ -68,5 +56,21 @@
"empty_nickname_error": "Nickname can't be empty",
"@empty_nickname_error": {
"description": "Error displayed when the user validate a null nickname"
},
"shuffle": "Shuffle",
"@shuffle": {
"description": "Shuffle button label"
},
"solve": "Solve",
"@solve": {
"description": "Solve button label"
},
"team_name": "Xpeho mobile",
"@team_name": {
"description": "Team name"
},
"victory_title": "You win !",
"@victory_title": {
"description": "Victory title"
}
}
8 changes: 6 additions & 2 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"app_name": "Puzzle",
"shuffle": "Mélanger",
"app_name": "Flutter Puzzle Hack",
"company_name": "XPEHO",
"complexity": "Complexité {complexityValue}",
"moves": "Déplacements : {count}",
"play": "Jouer",
"restart_btn": "Recommencer",
"shuffle": "Mélanger",
"solve": "Résoudre",
"team_name": "Xpeho mobile",
"moves": "Mouvements {count}",
Expand Down
132 changes: 64 additions & 68 deletions lib/view/homepage/homepage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,90 +21,86 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Center(
child: Text(
AppLocalizations.of(context)!.team_name,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 48,
fontFamily: "QueenOfTheModernAge",
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Center(
child: Text(
AppLocalizations.of(context)!.team_name,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 48,
fontFamily: "QueenOfTheModernAge",
),
),
),
Expanded(
child: Center(
child: Column(
children: [
if (isFirebaseUsable())
TextFormField(
cursorWidth: 1,
textInputAction: TextInputAction.done,
decoration: InputDecoration(
hintText:
AppLocalizations.of(context)!.nickname_hint,
contentPadding: const EdgeInsets.all(12.0),
fillColor: Colors.white,
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey[600]!,
),
),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey[600]!,
),
),
Expanded(
child: Center(
child: Column(
children: [
if (isFirebaseUsable())
TextFormField(
cursorWidth: 1,
textInputAction: TextInputAction.done,
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.nickname_hint,
contentPadding: const EdgeInsets.all(12.0),
fillColor: Colors.white,
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey[600]!,
),
),
style: TextStyle(
fontSize: 16,
color: Colors.grey[600]!,
border: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey[600]!,
),
),
onChanged: (term) {
setState(() {
nickname = term;
});
},
),
const SizedBox(height: 16),
MenuButton(
redirection: () {
LeaderboardProvider().updateUserNickname(nickname);
GoRouter.of(context).go(
PuzzlePage.route,
);
style: TextStyle(
fontSize: 16,
color: Colors.grey[600]!,
),
onChanged: (term) {
setState(() {
nickname = term;
});
},
text: AppLocalizations.of(context)!.play,
isClickable: nickname.isNotEmpty,
),
],
),
const SizedBox(height: 16),
MenuButton(
redirection: () {
LeaderboardProvider().updateUserNickname(nickname);
GoRouter.of(context).go(
PuzzlePage.route,
);
},
text: AppLocalizations.of(context)!.play,
isClickable: nickname.isNotEmpty,
),
],
),
),
if (isFirebaseUsable())
Expanded(
child: Center(
child: MenuButton(
redirection: () => GoRouter.of(context).go(
LeaderboardPage.route,
),
text: AppLocalizations.of(context)!.leaderboard_btn,
isClickable: true,
),
if (isFirebaseUsable())
Expanded(
child: Center(
child: MenuButton(
redirection: () => GoRouter.of(context).go(
LeaderboardPage.route,
),
text: AppLocalizations.of(context)!.leaderboard_btn,
isClickable: true,
),
),
],
),
),
],
),
),
);
Expand Down
Loading

0 comments on commit 869124b

Please sign in to comment.