Skip to content

Commit 18c7994

Browse files
committed
process #280
1 parent 7286c8c commit 18c7994

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

example/lib/demo/issue274.dart

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
}

lib/src/widget/helper/toast_helper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)