Skip to content

Commit

Permalink
[*] improve ui
Browse files Browse the repository at this point in the history
  • Loading branch information
heng30 committed May 23, 2024
1 parent 9300808 commit 7816f7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/pages/song.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class _SongPageState extends State<SongPage> {
text: "没有歌词".tr,
size: orientation == Orientation.portrait
? null
: Get.height * 0.2,
: Get.height * 0.4,
),
)
: const SizedBox(
Expand Down Expand Up @@ -154,6 +154,7 @@ class _SongPageState extends State<SongPage> {
borderRadius: BorderRadius.circular(CTheme.borderRadius),
child: GestureDetector(
child: SizedBox(
width: double.infinity,
child: Image.asset(
song.albumArtImagePath,
fit: BoxFit.cover,
Expand Down Expand Up @@ -229,6 +230,7 @@ class _SongPageState extends State<SongPage> {
showVSliderDialog(
context,
initValue: playerController.volume * 100,
height: min(300, Get.height * 0.6),
onChanged: (value) {
playerController.setVolumn(value / 100.0);
},
Expand Down Expand Up @@ -354,7 +356,10 @@ class _SongPageState extends State<SongPage> {

Widget buildLandscapeLayout(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(CTheme.padding * 5),
padding: const EdgeInsets.symmetric(
vertical: CTheme.padding * 4,
horizontal: CTheme.padding * 5,
),
child: Obx(
() => Row(
children: [
Expand Down
9 changes: 7 additions & 2 deletions lib/widgets/vslider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,19 @@ void showVSliderDialog(
required initValue,
required Function(double) onChanged,
}) {
final size = MediaQuery.of(context).size;
final orientation = MediaQuery.of(context).orientation;

showDialog(
context: context,
barrierColor: Colors.transparent,
builder: (BuildContext context) {
final windowSize = MediaQuery.of(context).size;
return Dialog(
insetPadding: EdgeInsets.symmetric(
horizontal: (windowSize.width - width - CTheme.margin * 2) / 2),
horizontal: orientation == Orientation.portrait
? (size.width - width) / 2
: (size.width - width - CTheme.margin * 8) / 2,
),
child: SizedBox(
height: height,
child: VSlider(
Expand Down

0 comments on commit 7816f7c

Please sign in to comment.