File tree Expand file tree Collapse file tree 2 files changed +52
-1
lines changed
Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart' ;
3+
4+ void main () {
5+ runApp (const MyApp ());
6+ }
7+
8+ class MyApp extends StatelessWidget {
9+ const MyApp ({super .key});
10+
11+ @override
12+ Widget build (BuildContext context) {
13+ return MaterialApp (
14+ title: 'Flutter Demo' ,
15+ theme: ThemeData (
16+ colorScheme: ColorScheme .fromSeed (seedColor: Colors .deepPurple)),
17+ builder: FlutterSmartDialog .init (),
18+ home: const MyHomePage (),
19+ );
20+ }
21+ }
22+
23+ class MyHomePage extends StatefulWidget {
24+ const MyHomePage ({super .key});
25+
26+ @override
27+ State <MyHomePage > createState () => _MyHomePageState ();
28+ }
29+
30+ class _MyHomePageState extends State <MyHomePage > {
31+ void _incrementCounter () {}
32+
33+ @override
34+ Widget build (BuildContext context) {
35+ return Scaffold (
36+ appBar: AppBar (
37+ backgroundColor: Theme .of (context).colorScheme.inversePrimary,
38+ title: const Text ("Demo" ),
39+ ),
40+ body: const Center (
41+ child: SelectableText (
42+ "this is a long select text to test smart dialog with copy" ),
43+ ),
44+ floatingActionButton: FloatingActionButton (
45+ onPressed: _incrementCounter,
46+ tooltip: 'Increment' ,
47+ child: const Icon (Icons .add),
48+ ),
49+ );
50+ }
51+ }
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class _ToastHelperState extends State<ToastHelper> with WidgetsBindingObserver {
3333 if (! mounted) return ;
3434
3535 final renderBox = _childContext? .findRenderObject () as RenderBox ? ;
36- if (renderBox != null ) {
36+ if (renderBox != null && renderBox.hasSize ) {
3737 selfOffset = renderBox.localToGlobal (Offset .zero);
3838 selfSize = renderBox.size;
3939 }
You can’t perform that action at this time.
0 commit comments