Skip to content

Commit

Permalink
changelog:
Browse files Browse the repository at this point in the history
UI corrections
basic implementation for translations
  • Loading branch information
gokadzev committed Jun 26, 2022
1 parent 0092764 commit 9d77bdc
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 69 deletions.
3 changes: 3 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/localization
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
32 changes: 32 additions & 0 deletions lib/localization/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"about": "About",
"accentChangeMsg": "Accent color has been changed, move to other page to see changes",
"accentColor": "Accent color",
"add": "Add",
"appUpdateAvailableAndDownloading": "App update is available and downloading",
"appUpdateIsNotAvailable": "App update is not available",
"backupUserData": "Backup user data",
"backupedSuccesfully": "Backuped Succesfully",
"cacheMsg": "Cache cleared",
"clearCache": "Clear cache",
"downloadAppUpdate": "Download app update",
"localSongs": "Local songs",
"lyrics": "Lyrics",
"lyricsNotAvailable": "No lyrics available ;(",
"nowPlaying": "Now playing",
"playAll": "Play all",
"playlist": "Playlist",
"playlists": "Playlists",
"queueInitText": "Initialising queue... because of perfomance, only first 20 songs will be added in the queue.",
"recommendedForYou": "Recommended for you",
"restoreUserData": "Restore user data",
"restoredSuccesfully": "Restored Succesfully",
"search": "Search",
"settings": "Settings",
"suggestedPlaylists": "Suggested playlists",
"userLikedSongs": "User liked songs",
"userPlaylists": "User playlists",
"yourDownloadedSongsHere": "Your downloaded songs here",
"yourFavoriteSongsHere": "Your favorite songs here",
"youtubePlaylistID": "Youtube playlist ID"
}
16 changes: 16 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get_it/get_it.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hive_flutter/hive_flutter.dart';
Expand All @@ -12,11 +13,18 @@ import 'package:musify/services/data_manager.dart';
import 'package:musify/style/appColors.dart';
import 'package:musify/ui/rootPage.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

GetIt getIt = GetIt.instance;
Locale _locale = const Locale('en', '');

main() async {
await Hive.initFlutter();
final String lang = await getData("settings", "languages") ?? "English";
final Map<String, String> codes = {
'English': 'en',
};
_locale = Locale(codes[lang]!);
await getLocalSongs();
await FlutterDownloader.initialize(
debug:
Expand Down Expand Up @@ -55,6 +63,14 @@ class MyApp extends StatelessWidget {
},
),
),
localizationsDelegates: [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [Locale('en', '')],
locale: _locale,
home: Musify(),
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/aboutPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:musify/helper/version.dart';
import 'package:musify/style/appColors.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class AboutPage extends StatelessWidget {
@override
Expand All @@ -13,7 +14,7 @@ class AboutPage extends StatelessWidget {
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark),
centerTitle: true,
title: Text(
"About",
AppLocalizations.of(context)!.about,
style: TextStyle(
color: accent,
fontSize: 25,
Expand Down
6 changes: 4 additions & 2 deletions lib/ui/homePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:musify/customWidgets/song_bar.dart';
import 'package:musify/customWidgets/spinner.dart';
import 'package:musify/style/appColors.dart';
import 'package:musify/ui/playlistPage.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class HomePage extends StatefulWidget {
@override
Expand Down Expand Up @@ -52,7 +53,8 @@ class _HomePageState extends State<HomePage> {
right: 25,
),
child: Text(
"Suggested Playlists",
AppLocalizations.of(context)!
.suggestedPlaylists,
style: TextStyle(
color: accent,
fontSize: 20.0,
Expand Down Expand Up @@ -106,7 +108,7 @@ class _HomePageState extends State<HomePage> {
right: 25,
),
child: Text(
"Recommended for you",
AppLocalizations.of(context)!.recommendedForYou,
style: TextStyle(
color: accent,
fontSize: 20.0,
Expand Down
16 changes: 10 additions & 6 deletions lib/ui/localSongsPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
import 'package:musify/API/musify.dart';
import 'package:musify/services/audio_manager.dart';
import 'package:musify/style/appColors.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class LocalSongsPage extends StatelessWidget {
const LocalSongsPage({Key? key}) : super(key: key);
Expand All @@ -17,7 +18,7 @@ class LocalSongsPage extends StatelessWidget {
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark),
centerTitle: true,
title: Text(
"Local Songs",
AppLocalizations.of(context)!.localSongs,
style: TextStyle(
color: accent,
fontSize: 25,
Expand Down Expand Up @@ -62,7 +63,7 @@ class LocalSongsPage extends StatelessWidget {
color: accent,
),
Text(
"Local Songs",
AppLocalizations.of(context)!.localSongs,
style: TextStyle(color: accent),
textAlign: TextAlign.center,
),
Expand All @@ -78,7 +79,7 @@ class LocalSongsPage extends StatelessWidget {
children: [
const SizedBox(height: 12.0),
Text(
"Local Songs",
AppLocalizations.of(context)!.localSongs,
style: TextStyle(
color: accent,
fontSize: 18,
Expand All @@ -87,7 +88,7 @@ class LocalSongsPage extends StatelessWidget {
),
const SizedBox(height: 16.0),
Text(
"Your downloaded songs here!",
"${AppLocalizations.of(context)!.yourDownloadedSongsHere}!",
style: TextStyle(
color: accent,
fontSize: 10,
Expand All @@ -104,8 +105,11 @@ class LocalSongsPage extends StatelessWidget {
style: TextButton.styleFrom(
backgroundColor: accent,
),
child: const Text(
"PLAY ALL",
child: Text(
AppLocalizations.of(context)!
.playAll
.toString()
.toUpperCase(),
style: TextStyle(color: Colors.white),
),
),
Expand Down
13 changes: 9 additions & 4 deletions lib/ui/player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:musify/API/musify.dart';
import 'package:musify/customWidgets/spinner.dart';
import 'package:musify/services/audio_manager.dart';
import 'package:musify/style/appColors.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

String status = 'hidden';

Expand Down Expand Up @@ -53,7 +54,7 @@ class AudioAppState extends State<AudioApp> {
elevation: 0,
centerTitle: true,
title: Text(
"Now Playing",
AppLocalizations.of(context)!.nowPlaying,
style: TextStyle(
color: accent,
fontSize: 25,
Expand Down Expand Up @@ -409,7 +410,9 @@ class AudioAppState extends State<AudioApp> {
),
child: Center(
child: Text(
"Lyrics",
AppLocalizations.of(
context)!
.lyrics,
style: TextStyle(
color: accent,
fontSize: 30,
Expand Down Expand Up @@ -458,7 +461,9 @@ class AudioAppState extends State<AudioApp> {
child: Center(
child: Container(
child: Text(
"No Lyrics available ;(",
AppLocalizations.of(
context)!
.lyricsNotAvailable,
style: TextStyle(
color: accentLight,
fontSize: 25,
Expand All @@ -474,7 +479,7 @@ class AudioAppState extends State<AudioApp> {
);
},
child: Text(
"Lyrics",
AppLocalizations.of(context)!.lyrics,
style: TextStyle(color: accent),
),
);
Expand Down
14 changes: 9 additions & 5 deletions lib/ui/playlistPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:musify/API/musify.dart';
import 'package:musify/customWidgets/song_bar.dart';
import 'package:musify/customWidgets/spinner.dart';
import 'package:musify/style/appColors.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class PlaylistPage extends StatefulWidget {
final dynamic playlist;
Expand Down Expand Up @@ -82,7 +83,7 @@ class _PlaylistPageState extends State<PlaylistPage> {
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark),
centerTitle: true,
title: Text(
"Playlist",
AppLocalizations.of(context)!.playlist,
style: TextStyle(
color: accent,
fontSize: 25,
Expand Down Expand Up @@ -186,8 +187,8 @@ class _PlaylistPageState extends State<PlaylistPage> {
widget.playlist["list"] as List,
),
Fluttertoast.showToast(
msg:
"Initialising queue... Because of perfomance, only first 20 songs will be added in the queue.",
msg: AppLocalizations.of(context)!
.queueInitText,
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
backgroundColor: accent,
Expand All @@ -198,8 +199,11 @@ class _PlaylistPageState extends State<PlaylistPage> {
style: TextButton.styleFrom(
backgroundColor: accent,
),
child: const Text(
"PLAY ALL",
child: Text(
AppLocalizations.of(context)!
.playAll
.toString()
.toUpperCase(),
style: TextStyle(color: Colors.white),
),
),
Expand Down
42 changes: 18 additions & 24 deletions lib/ui/playlistsPage.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:musify/API/musify.dart';
import 'package:musify/customWidgets/spinner.dart';
import 'package:musify/style/appColors.dart';
import 'package:musify/ui/playlistPage.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class PlaylistsPage extends StatefulWidget {
@override
Expand All @@ -15,33 +17,25 @@ class _PlaylistsPageState extends State<PlaylistsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: bgColor,
backgroundColor: Colors.transparent,
appBar: AppBar(
systemOverlayStyle:
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark),
centerTitle: true,
title: Text(
AppLocalizations.of(context)!.playlists,
style: TextStyle(
color: accent,
fontSize: 30,
fontWeight: FontWeight.w700,
),
),
backgroundColor: Colors.transparent,
elevation: 0,
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
const Padding(padding: EdgeInsets.only(top: 10, bottom: 20.0)),
Center(
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.zero,
child: Center(
child: Text(
"Playlists",
style: TextStyle(
color: accent,
fontSize: 35,
fontWeight: FontWeight.w800,
),
),
),
),
),
],
),
),
const Padding(padding: EdgeInsets.only(top: 20)),
FutureBuilder(
future: getPlaylists(),
builder: (context, data) {
Expand Down
22 changes: 20 additions & 2 deletions lib/ui/searchPage.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:musify/API/musify.dart';
import 'package:musify/customWidgets/song_bar.dart';
import 'package:musify/customWidgets/spinner.dart';
import 'package:musify/style/appColors.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class SearchPage extends StatefulWidget {
@override
Expand All @@ -27,11 +29,27 @@ class _SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
systemOverlayStyle:
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark),
centerTitle: true,
title: Text(
AppLocalizations.of(context)!.search,
style: TextStyle(
color: accent,
fontSize: 30,
fontWeight: FontWeight.w700,
),
),
backgroundColor: Colors.transparent,
elevation: 0,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(12.0),
child: Column(
children: <Widget>[
const Padding(padding: EdgeInsets.only(top: 30, bottom: 20.0)),
const Padding(padding: EdgeInsets.only(bottom: 20.0)),
TextField(
onSubmitted: (String value) {
search();
Expand Down Expand Up @@ -75,7 +93,7 @@ class _SearchPageState extends State<SearchPage> {
},
),
border: InputBorder.none,
hintText: "Search...",
hintText: "${AppLocalizations.of(context)!.search}...",
hintStyle: TextStyle(
color: accent,
),
Expand Down
Loading

0 comments on commit 9d77bdc

Please sign in to comment.