Skip to content

Commit a91ecf9

Browse files
committed
process #280
1 parent 7286c8c commit a91ecf9

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

example/lib/demo/issue274.dart

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

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)