Skip to content

Commit

Permalink
修复 toast
Browse files Browse the repository at this point in the history
  • Loading branch information
MCredbear committed Dec 20, 2024
1 parent 4d8361c commit e3ad5e1
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:music_tools_flutter/file_manager_page/file_manager_page.dart';
import 'package:permission_handler/permission_handler.dart';

Expand Down Expand Up @@ -85,23 +86,26 @@ class _MyAppState extends State<MyApp> {

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Music tools Flutter',
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false),
home: _isPermissionGranted
? const PickPage()
: Center(
child: ElevatedButton(
onPressed: () {
if (Platform.isAndroid) {
requestPermission(context);
}
},
child: const Text(
'点击获取本应用所需的权限',
textAlign: TextAlign.center,
)),
),
return StyledToast(
locale: const Locale('zh', 'CN'),
child: MaterialApp(
title: 'Music tools Flutter',
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false),
home: _isPermissionGranted
? const PickPage()
: Center(
child: ElevatedButton(
onPressed: () {
if (Platform.isAndroid) {
requestPermission(context);
}
},
child: const Text(
'点击获取本应用所需的权限',
textAlign: TextAlign.center,
)),
),
),
);
}
}
Expand Down

0 comments on commit e3ad5e1

Please sign in to comment.