Skip to content

Commit

Permalink
removed google account support
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikh Haziq committed Nov 21, 2024
1 parent c3c0249 commit 7e53dbc
Show file tree
Hide file tree
Showing 22 changed files with 939 additions and 1,353 deletions.
2 changes: 1 addition & 1 deletion lib/app_config.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppConfig appConfig = AppConfig(version: 32, codeName: '2.0.7');
AppConfig appConfig = AppConfig(version: 33, codeName: '2.0.8');

class AppConfig {
int version;
Expand Down
2 changes: 0 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import 'services/library.dart';
import 'services/lyrics.dart';
import 'services/media_player.dart';
import 'services/settings_manager.dart';
import 'services/yt_account.dart';
import 'themes/colors.dart';
import 'themes/dark.dart';
import 'themes/light.dart';
Expand Down Expand Up @@ -102,7 +101,6 @@ void main() async {
GetIt.I.registerSingleton<FileStorage>(fileStorage);

GetIt.I.registerSingleton<LibraryService>(libraryService);
GetIt.I.registerSingleton<YTAccount>(YTAccount());
GetIt.I.registerSingleton<Lyrics>(Lyrics());

runApp(
Expand Down
236 changes: 81 additions & 155 deletions lib/screens/main_screen/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import 'package:device_info_plus/device_info_plus.dart';
import 'package:fluent_ui/fluent_ui.dart' as fluent_ui;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:salomon_bottom_bar/salomon_bottom_bar.dart';
import 'package:window_manager/window_manager.dart';

import '../../generated/l10n.dart';
import '../../services/yt_account.dart';
import '../../themes/text_styles.dart';
import '../../utils/adaptive_widgets/adaptive_widgets.dart';
import '../../utils/bottom_modals.dart';
Expand Down Expand Up @@ -111,153 +109,96 @@ class _MainScreenState extends State<MainScreen> with WindowListener {
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return ValueListenableBuilder(
valueListenable: GetIt.I<YTAccount>().isLogged,
builder: (context, isLogged, child) {
return Platform.isWindows
? _buildWindowsMain(
_goBranch,
widget.navigationShell,
isLogged: isLogged,
)
: Scaffold(
body: Column (
return Platform.isWindows
? _buildWindowsMain(
_goBranch,
widget.navigationShell,
)
: Scaffold(
body: Column(
children: [
Expanded(
child: Row(
children: [
Expanded(
child: Row(
children: [
if (screenWidth >= 450)
NavigationRail(
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
labelType: NavigationRailLabelType.none,
selectedLabelTextStyle:
smallTextStyle(context, bold: true),
extended: (screenWidth > 1000),
onDestinationSelected: (index) {
int currentIndex = isLogged
? index
: index >= 2
? index + 1
: index;
_goBranch(currentIndex);
},
destinations: [
NavigationRailDestination(
selectedIcon: const Icon(
CupertinoIcons.music_house_fill),
icon:
const Icon(CupertinoIcons.music_house),
label: Text(
S.of(context).Home,
style:
smallTextStyle(context, bold: false),
),
),
NavigationRailDestination(
selectedIcon: const Icon(
Icons.library_music_outlined),
icon: const Icon(
Icons.library_music_outlined),
label: Text(
S.of(context).Saved,
style:
smallTextStyle(context, bold: false),
),
),
if (isLogged)
NavigationRailDestination(
selectedIcon: const Icon(
CupertinoIcons.music_note_2),
icon:
const Icon(CupertinoIcons.music_note),
label: Text(
S.of(context).YTMusic,
style: smallTextStyle(context,
bold: false),
),
),
NavigationRailDestination(
selectedIcon: const Icon(
CupertinoIcons.gear_alt_fill),
icon: const Icon(CupertinoIcons.gear_alt),
label: Text(
S.of(context).Settings,
style:
smallTextStyle(context, bold: false),
),
)
],
selectedIndex: isLogged
? widget.navigationShell.currentIndex
: widget.navigationShell.currentIndex >= 2
? widget.navigationShell.currentIndex -
1
: widget.navigationShell.currentIndex,
),
Expanded(
child: widget.navigationShell,
),
],
),
),
const BottomPlayer()
],
),
bottomNavigationBar: screenWidth < 450
? SalomonBottomBar(
currentIndex: isLogged
? widget.navigationShell.currentIndex
: widget.navigationShell.currentIndex >= 2
? widget.navigationShell.currentIndex - 1
: widget.navigationShell.currentIndex,
items: [
SalomonBottomBarItem(
activeIcon:
if (screenWidth >= 450)
NavigationRail(
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
labelType: NavigationRailLabelType.none,
selectedLabelTextStyle:
smallTextStyle(context, bold: true),
extended: (screenWidth > 1000),
onDestinationSelected: _goBranch,
destinations: [
NavigationRailDestination(
selectedIcon:
const Icon(CupertinoIcons.music_house_fill),
icon: const Icon(CupertinoIcons.music_house),
title: Text(S.of(context).Home),
label: Text(
S.of(context).Home,
style: smallTextStyle(context, bold: false),
),
),
SalomonBottomBarItem(
activeIcon: const Icon(Icons.library_music),
NavigationRailDestination(
selectedIcon:
const Icon(Icons.library_music_outlined),
icon: const Icon(Icons.library_music_outlined),
title: Text(S.of(context).Saved),
),
if (isLogged)
SalomonBottomBarItem(
activeIcon:
const Icon(CupertinoIcons.music_note_2),
icon: const Icon(CupertinoIcons.music_note),
title: Text(S.of(context).YTMusic),
label: Text(
S.of(context).Saved,
style: smallTextStyle(context, bold: false),
),
SalomonBottomBarItem(
activeIcon:
const Icon(CupertinoIcons.settings_solid),
icon: const Icon(CupertinoIcons.settings),
title: Text(S.of(context).Settings),
),
NavigationRailDestination(
selectedIcon:
const Icon(CupertinoIcons.gear_alt_fill),
icon: const Icon(CupertinoIcons.gear_alt),
label: Text(
S.of(context).Settings,
style: smallTextStyle(context, bold: false),
),
)
],
backgroundColor:
Theme.of(context).colorScheme.surfaceContainerLow,
onTap: (index) {
int currentIndex = isLogged
? index
: index >= 2
? index + 1
: index;
_goBranch(currentIndex);
},
)
: null,
);
});
selectedIndex: widget.navigationShell.currentIndex,
),
Expanded(
child: widget.navigationShell,
),
],
),
),
const BottomPlayer()
],
),
bottomNavigationBar: screenWidth < 450
? SalomonBottomBar(
currentIndex: widget.navigationShell.currentIndex,
items: [
SalomonBottomBarItem(
activeIcon: const Icon(CupertinoIcons.music_house_fill),
icon: const Icon(CupertinoIcons.music_house),
title: Text(S.of(context).Home),
),
SalomonBottomBarItem(
activeIcon: const Icon(Icons.library_music),
icon: const Icon(Icons.library_music_outlined),
title: Text(S.of(context).Saved),
),
SalomonBottomBarItem(
activeIcon: const Icon(CupertinoIcons.settings_solid),
icon: const Icon(CupertinoIcons.settings),
title: Text(S.of(context).Settings),
),
],
backgroundColor:
Theme.of(context).colorScheme.surfaceContainerLow,
onTap: _goBranch,
)
: null,
);
}

_buildWindowsMain(
Function goTOBranch,
StatefulNavigationShell navigationShell, {
bool isLogged = false,
}) {
Function goTOBranch, StatefulNavigationShell navigationShell) {
return Directionality(
textDirection: fluent_ui.TextDirection.ltr,
child: fluent_ui.NavigationView(
Expand Down Expand Up @@ -287,11 +228,7 @@ class _MainScreenState extends State<MainScreen> with WindowListener {
);
},
pane: fluent_ui.NavigationPane(
selected: isLogged
? widget.navigationShell.currentIndex
: widget.navigationShell.currentIndex >= 2
? widget.navigationShell.currentIndex - 1
: widget.navigationShell.currentIndex,
selected: widget.navigationShell.currentIndex,
size: const fluent_ui.NavigationPaneSize(
compactWidth: 60,
),
Expand All @@ -316,17 +253,6 @@ class _MainScreenState extends State<MainScreen> with WindowListener {
body: const SizedBox.shrink(),
onTap: () => goTOBranch(1),
),
if (isLogged)
fluent_ui.PaneItem(
key: const ValueKey('/ytmusic'),
icon: const Icon(
fluent_ui.FluentIcons.music_note,
size: 30,
),
title: Text(S.of(context).YTMusic),
body: const SizedBox.shrink(),
onTap: () => goTOBranch(2),
),
],
footerItems: [
fluent_ui.PaneItem(
Expand All @@ -337,7 +263,7 @@ class _MainScreenState extends State<MainScreen> with WindowListener {
),
title: Text(S.of(context).Settings),
body: const SizedBox.shrink(),
onTap: () => goTOBranch(3),
onTap: () => goTOBranch(2),
)
]),
),
Expand Down
87 changes: 0 additions & 87 deletions lib/screens/settings_screen/account/account_screen.dart

This file was deleted.

Loading

0 comments on commit 7e53dbc

Please sign in to comment.