diff --git a/lib/screens/now_playing_page.dart b/lib/screens/now_playing_page.dart index 597eadeca..8e5c49b53 100644 --- a/lib/screens/now_playing_page.dart +++ b/lib/screens/now_playing_page.dart @@ -9,6 +9,7 @@ import 'package:musify/main.dart'; import 'package:musify/models/position_data.dart'; import 'package:musify/services/settings_manager.dart'; import 'package:musify/style/app_themes.dart'; +import 'package:musify/utilities/flutter_bottom_sheet.dart'; import 'package:musify/utilities/flutter_toast.dart'; import 'package:musify/utilities/formatter.dart'; import 'package:musify/utilities/mediaitem.dart'; @@ -392,7 +393,7 @@ class _NowPlayingPageState extends State { children: [ TextButton( onPressed: () { - _showBottomSheet( + showCustomBottomSheet( context, ListView.builder( shrinkWrap: true, @@ -428,7 +429,7 @@ class _NowPlayingPageState extends State { mediaItem.artist.toString(), mediaItem.title.toString(), ); - _showBottomSheet( + showCustomBottomSheet( context, ValueListenableBuilder( valueListenable: lyrics, @@ -471,44 +472,6 @@ class _NowPlayingPageState extends State { ); } - void _showBottomSheet(BuildContext context, Widget content) { - showBottomSheet( - context: context, - builder: (context) => Container( - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(18), - topRight: Radius.circular(18), - ), - ), - width: MediaQuery.of(context).size.width - 15, - height: MediaQuery.of(context).size.height / 2.14, - child: Column( - children: [ - Padding( - padding: EdgeInsets.only( - top: MediaQuery.of(context).size.height * 0.012, - ), - child: IconButton( - icon: Icon( - FluentIcons.arrow_between_down_24_filled, - color: colorScheme.primary, - size: 20, - ), - onPressed: () => Navigator.pop(context), - ), - ), - Expanded( - child: SingleChildScrollView( - child: content, - ), - ), - ], - ), - ), - ); - } - void _showAddToPlaylistDialog(BuildContext context, dynamic song) { showDialog( context: context, diff --git a/lib/utilities/flutter_bottom_sheet.dart b/lib/utilities/flutter_bottom_sheet.dart new file mode 100644 index 000000000..98484771a --- /dev/null +++ b/lib/utilities/flutter_bottom_sheet.dart @@ -0,0 +1,41 @@ +import 'package:fluentui_system_icons/fluentui_system_icons.dart'; +import 'package:flutter/material.dart'; +import 'package:musify/style/app_themes.dart'; + +void showCustomBottomSheet(BuildContext context, Widget content) { + showBottomSheet( + context: context, + builder: (context) => Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(18), + topRight: Radius.circular(18), + ), + ), + width: MediaQuery.of(context).size.width - 15, + height: MediaQuery.of(context).size.height / 2.14, + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context).size.height * 0.012, + ), + child: IconButton( + icon: Icon( + FluentIcons.arrow_between_down_24_filled, + color: colorScheme.primary, + size: 20, + ), + onPressed: () => Navigator.pop(context), + ), + ), + Expanded( + child: SingleChildScrollView( + child: content, + ), + ), + ], + ), + ), + ); +}