Comments (4)
@JackalTsc 改了下上面的demo用法,你可以参考看看
from flutter_smart_dialog.
- 下面这个demo可以解决你的问题,你试试吧
class TestPage extends StatelessWidget {
const TestPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
alignment: Alignment.center,
child: ElevatedButton(
onPressed: () => _onTap(context),
child: const Text("弹窗"),
),
),
);
}
void _onTap(BuildContext context) {
SmartDialog.show(
onDismiss: () => FocusScope.of(context).requestFocus(),
builder: (_) => const TestDialog(),
);
}
}
class TestDialog extends StatefulWidget {
const TestDialog({Key? key}) : super(key: key);
@override
State<TestDialog> createState() => _TestDialogState();
}
class _TestDialogState extends State<TestDialog> {
final _focusNode = FocusNode();
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_focusNode.requestFocus();
});
super.initState();
}
@override
Widget build(BuildContext context) {
return AnimatedPadding(
padding: MediaQuery.of(context).viewInsets,
duration: const Duration(milliseconds: 100),
child: Container(
height: 100,
width: 300,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
alignment: Alignment.center,
child: TextField(focusNode: _focusNode),
),
);
}
}
from flutter_smart_dialog.
可以了,谢谢
from flutter_smart_dialog.
新版本好像通过FocusNode这么弄还是有问题,加了延时才行,有更优雅的处理方式吗
from flutter_smart_dialog.
Related Issues (20)
- 某种情况下loading弹窗会消失或卡顿 HOT 5
- Toast文字水平居中
- 请教一个问题
- 可否自己处理返回事件 HOT 2
- DateRangePicker被遮住 HOT 2
- 在app内部展示web view时,dialog的事件会穿透到webview(点击元素而不是遮罩),设置了各种方法均无法避免 HOT 1
- 通过smartDialog.show的形式自定义的widget上有输入框键盘遮挡问题。 HOT 3
- fluent_ui库如何初始化smartdialog? HOT 12
- SmartDialog.show时超出builder的部分无法响应点击 HOT 5
- isolate中弹窗无效,提示并未初始化,有没有什么在isolate中使用的方案 HOT 1
- visibility_detector 在iOS上 左滑返回有几率会出发两次 HOT 1
- dialog和toast交替切换操作,控制台会报以下错误,且 HOT 1
- lastToast没有在overlayEntry.remove()的时候判断mounted,导致有几率报错 HOT 3
- 需求 HOT 2
- bindWidget 没有作用 HOT 2
- 4.9.7Adaptation problem HOT 4
- Looking up a deactivated widget's ancestor is unsafe. HOT 21
- release模式dialog完全出不来 HOT 7
- 网络请求封装不显示toast HOT 11
- dialog和loading显示/隐藏 异常 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_smart_dialog.