Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
natsuk4ze committed Jul 29, 2023
1 parent cee4798 commit d33ba42
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
2 changes: 1 addition & 1 deletion example/integration_test/test_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:gal/gal.dart';

var logger = Logger();

Future<void> main() async => runApp(const App());
void main() => runApp(const App());

class App extends StatefulWidget {
const App({super.key});
Expand Down
12 changes: 0 additions & 12 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ class App extends StatelessWidget {
);
},
label: 'Best Practice',
icon: Icons.done,
),
_Button(
onPressed: () async => Gal.open(),
label: 'Open Gallery',
icon: Icons.open_in_new,
),
_Button(
onPressed: () async {
Expand All @@ -77,7 +75,6 @@ class App extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
label: 'Save Video from local',
icon: Icons.video_file,
),
_Button(
onPressed: () async {
Expand All @@ -91,7 +88,6 @@ class App extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
label: 'Download Video',
icon: Icons.video_file_outlined,
),
_Button(
onPressed: () async {
Expand All @@ -101,7 +97,6 @@ class App extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
label: 'Save Image from local',
icon: Icons.image,
),
_Button(
onPressed: () async {
Expand All @@ -113,7 +108,6 @@ class App extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
label: 'Save Image from bytes',
icon: Icons.image_rounded,
),
_Button(
onPressed: () async {
Expand All @@ -127,23 +121,20 @@ class App extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
label: 'Download Image',
icon: Icons.image_outlined,
),
_Button(
onPressed: () async {
final hasAccess = await Gal.hasAccess();
log('Has Access:${hasAccess.toString()}');
},
label: 'Has Access',
icon: Icons.question_mark,
),
_Button(
onPressed: () async {
final requestGranted = await Gal.requestAccess();
log('Request Granted:${requestGranted.toString()}');
},
label: 'Request Access',
icon: Icons.privacy_tip_outlined,
),
],
),
Expand All @@ -168,12 +159,10 @@ class App extends StatelessWidget {
class _Button extends StatelessWidget {
const _Button({
required this.label,
required this.icon,
required this.onPressed,
});

final String label;
final IconData icon;
final void Function() onPressed;

@override
Expand All @@ -183,7 +172,6 @@ class _Button extends StatelessWidget {
child: FloatingActionButton.extended(
onPressed: onPressed,
label: Text(label),
icon: Icon(icon),
),
);
}
Expand Down

0 comments on commit d33ba42

Please sign in to comment.