Skip to content

Commit

Permalink
⚡️ Improve the example
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Jul 7, 2022
1 parent 2555927 commit ba51cb0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';
import 'package:photo_manager/photo_manager.dart';
Expand All @@ -9,7 +11,12 @@ import 'widget/image_item_widget.dart';

final PhotoProvider provider = PhotoProvider();

void main() => runApp(const _SimpleExampleApp());
void main() {
runZonedGuarded(
() => runApp(const _SimpleExampleApp()),
(Object e, StackTrace s) => showToast('$e\n$s', textAlign: TextAlign.start),
);
}

class _SimpleExampleApp extends StatelessWidget {
const _SimpleExampleApp({Key? key}) : super(key: key);
Expand All @@ -19,7 +26,10 @@ class _SimpleExampleApp extends StatelessWidget {
return OKToast(
child: ChangeNotifierProvider<PhotoProvider>.value(
value: provider, // This is for the advanced usages.
child: const MaterialApp(home: _SimpleExamplePage()),
child: const MaterialApp(
title: 'Photo Manager Example',
home: _SimpleExamplePage(),
),
),
);
}
Expand Down

0 comments on commit ba51cb0

Please sign in to comment.