File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed
Expand file tree Collapse file tree 2 files changed +50
-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 (colorScheme: ColorScheme .fromSeed (seedColor: Colors .deepPurple)),
16+ builder: FlutterSmartDialog .init (),
17+ home: const MyHomePage (),
18+ );
19+ }
20+ }
21+
22+ class MyHomePage extends StatefulWidget {
23+ const MyHomePage ({super .key});
24+
25+ @override
26+ State <MyHomePage > createState () => _MyHomePageState ();
27+ }
28+
29+ class _MyHomePageState extends State <MyHomePage > {
30+ void _incrementCounter () {}
31+
32+ @override
33+ Widget build (BuildContext context) {
34+ return Scaffold (
35+ appBar: AppBar (
36+ backgroundColor: Theme .of (context).colorScheme.inversePrimary,
37+ title: Text ("Demo" ),
38+ ),
39+ body: Center (
40+ child: SelectableText ("this is a long select text to test smart dialog with copy" ),
41+ ),
42+ floatingActionButton: FloatingActionButton (
43+ onPressed: _incrementCounter,
44+ tooltip: 'Increment' ,
45+ child: const Icon (Icons .add),
46+ ),
47+ );
48+ }
49+ }
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