小编New*_*ser的帖子

如何在用户单击 flutter 中的按钮后显示警报对话框

我是颤振新手,如果用户单击“计算”按钮,我会尝试显示结果的对话框警报。我想将“文本”结果更改为对话框警报,例如“(总天数)的预测是(结果)”任何人都可以帮助我如何做到这一点?我找不到合适的资源,谢谢

class TransactionYearly extends StatefulWidget {
  @override
  _TransactionYearlyState createState() => _TransactionYearlyState();
}

class _TransactionYearlyState extends State<TransactionYearly> {
  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
  final TextEditingController amount = new TextEditingController();

  final TextEditingController  day = new TextEditingController();

  double _result;

  @override
  void initState() {
    super.initState();
  }
  @override
  void dispose() {
    super.dispose();
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(getTranslated(context, 'prediction_calculation'),),
        elevation: 0,
        brightness: Brightness.light,
        backgroundColor: primary,
        leading: IconButton(
          onPressed: (){
            Navigator.pop(context, MaterialPageRoute(builder: (context) => Transactions()));
          },
          icon: Icon(Icons.arrow_back_ios,
            size: 20, …
Run Code Online (Sandbox Code Playgroud)

android-alertdialog android-studio flutter

1
推荐指数
1
解决办法
1万
查看次数