Skip to content

Commit

Permalink
hard reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-AV committed Aug 17, 2024
1 parent a8ca78c commit 9147c94
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion my_music_code/lib/Album/album_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class _MyAlbumPageState extends State<MyAlbumPage> {
leading: IconButton(
padding: EdgeInsets.zero,
onPressed: () {
while (universal.navigatorIndex != 1) {
while (universal.navigatorIndex != 1 && Navigator.canPop(context)) {
Navigator.pop(context);
setState(() {
universal.navigatorIndex--;
Expand Down
2 changes: 1 addition & 1 deletion my_music_code/lib/Feed/dialog_qrcode_music.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class _QrcodeGeneratorState extends State<QrcodeGenerator> {
padding: const EdgeInsets.symmetric(horizontal: 35),
child: GestureDetector(
onTap: () async {
await Share.share("Ouça essa música:\n${widget.music.link} \nVocê vai amar!");
await shareQRImage();

},
child: Container(
Expand Down
30 changes: 21 additions & 9 deletions my_music_code/lib/Profile/profile_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import 'package:audioplayers/audioplayers.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:my_music_code/Auth/Service/auth_service.dart';
import 'package:my_music_code/Globals/responsive_text.dart';
import 'package:my_music_code/Globals/style.dart';
import 'package:my_music_code/Models/album_model.dart';
import 'package:my_music_code/Models/music_model.dart';
import 'package:my_music_code/Models/sign_login_model.dart';
import 'package:my_music_code/Profile/configuration_page.dart';
// import 'package:my_music_code/Profile/friends_page.dart';
import 'package:my_music_code/legal/about_page.dart';
Expand All @@ -29,18 +33,13 @@ class _ProfileDrawerState extends State<ProfileDrawer> {
backgroundImage: CachedNetworkImageProvider(universal.user.photoURL ?? DefaultPlaceholder.image),
),
title: ResponsiveText(text: universal.user.displayName ?? universal.userModel.username, fontSize: 16),
subtitle: ResponsiveText(
text: "Configurar perfil",
fontSize: 12,
fontColor: Color(0xffA4A4A4)),
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => ConfigurationPage())),
subtitle: ResponsiveText(text: "Configurar perfil", fontSize: 12, fontColor: Color(0xffA4A4A4)),
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => ConfigurationPage())),
),
ListTile(
leading: Icon(Icons.settings, color: Colors.white),
title: ResponsiveText(text: "Configurar Perfil"),
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => ConfigurationPage())),
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => ConfigurationPage())),
),
ListTile(
leading: Icon(Icons.description, color: Colors.white),
Expand All @@ -55,7 +54,20 @@ class _ProfileDrawerState extends State<ProfileDrawer> {
ListTile(
leading: Icon(CupertinoIcons.arrow_left_circle, color: Colors.white),
title: ResponsiveText(text: "Deslogar"),
onTap: () => AuthService().signUserOut(),
onTap: () {
setState(() {
universal.audioPlayer.stop();
universal.audioPlayer = AudioPlayer();
universal.currentMusic = Music();
universal.releaseListMusics = List.empty(growable: true);
universal.currentListMusic = List.empty(growable: true);
universal.currentListMusicShuffle = List.empty(growable: true);
universal.userModel = SignLoginModel();
universal.currentAlbum = AlbumModel();
universal.navigatorIndex = 0;
});
AuthService().signUserOut();
},
),
],
),
Expand Down
5 changes: 2 additions & 3 deletions my_music_code/lib/universal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import 'package:my_music_code/Models/music_model.dart';
import 'package:my_music_code/Models/sign_login_model.dart';
import 'package:spotify/spotify.dart' hide User;

AudioPlayer audioPlayer = AudioPlayer();
Music currentMusic = Music();
late User user;
late SpotifyApi spotifyApi;
AudioPlayer audioPlayer = AudioPlayer();
Music currentMusic = Music();
List<Music> releaseListMusics = List.empty(growable: true);
List<Music> currentListMusic = List.empty(growable: true);
List<Music> currentListMusicShuffle = List.empty(growable: true);
SignLoginModel userModel = SignLoginModel();
AlbumModel currentAlbum = AlbumModel();

int navigatorIndex = 0;

0 comments on commit 9147c94

Please sign in to comment.