弹出对话框中的按动对话框

时间:2019-06-28 11:30:15

标签: flutter dart dialog

通过单击要弹出对话框的按钮,我有一个按钮,我通过使用showDialog并在那里调用我的对话框方法来做到这一点。但是我不知道如何使用图像文字并在一行中得分。

提供了图片,代码也提示我了吗?

这是使用showDialog的地方

      Row(
          children: <Widget>[
            RaisedButton(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0),
              textColor: Colors.black,
              child: Text(
                'LeaderBoard',
                style: TextStyle(
                  fontSize: 20.0,
                  fontWeight: FontWeight.bold,
                ),
              ),
              onPressed: () {

                showDialog(
                    context: context,
                    builder: (BuildContext context) => leadDialog);
              },
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10.0)),
           ),

我的对话方法

import 'package:flutter/material.dart';

Dialog leadDialog = Dialog(
  child: Container(
    height: 300.0,
    width: 360.0,
    color: Colors.white,
    child: Column(
      mainAxisAlignment: MainAxisAlignment.end,
      children: <Widget>[
        Padding(
          padding: EdgeInsets.all(15.0),
          child: Text(
            'Choose from Library',
            style:
            TextStyle(color: Colors.black, fontSize: 22.0),
          ),
        ),
      ],
    ),
  ),
);

预期结果是

enter image description here

2 个答案:

答案 0 :(得分:2)

enter image description here

                print("#########################################################################################")
                # ANTES DE EXECUTAR CADA UMA DAS QUERYS VEREFICAR QUAIS AS TABELAS QUE SAO UTLIZADAS EM CADA UMA
                # VERIFICAR QUE TABELAS EXISTEM PARA O PROFESSOR
                query = "EXPLAIN " + sqlqueryprof
                print("QUERY EXPLAIN DO PROFESSOR")
                print(query)
                #connection.commit()
                cursor = connection.cursor()
                cursor.execute(query)
                explain_prof = cur.fetchall()
                print("TABELA EXPLICATIVA DA QUERY DO PROFESSOR")
                data_frame_expl_prof = pandas.DataFrame(list(explain_prof))
                print(data_frame_expl_prof)

                # VERIFICAR QUE TABELAS EXISTEM PARA O ALUNO
                query = "EXPLAIN " + sqlqueryalun
                print("QUERY EXPLAIN DO ALUNO")
                print(query)
                #connection.commit()
                cursor = connection.cursor()
                cursor.execute(query)
                explain_alun = cur.fetchall()
                print("TABELA EXPLICATIVA DA QUERY DO ALUNO")
                data_frame_expl_alun = pandas.DataFrame(list(explain_alun))
                print(data_frame_expl_alun)

                print("#################################################################")
                # EXECUTAR CADA UMA DAS QUERYS
                cursor_prof = connection.cursor()
                cursor_prof.execute(sqlqueryprof)
                records_prof = cursor_prof.fetchall()

                data_frame_prof = pandas.DataFrame(list(records_prof))
                print("IMPRIMIR O DATA FRAME RESULTANTE DO PROFESSOR A CONEXAO")
                print(data_frame_prof)

                cursor_alun = connection.cursor()
                cursor_alun.execute(sqlqueryalun)
                records_query = cursor_alun.fetchall()

                data_frame_alun = pandas.DataFrame(list(records_query))
                print("IMPRIMIR O DATA FRAME RESULTANTE DO ALUNO A CONEXAO")
                print(data_frame_alun)

答案 1 :(得分:1)

您需要为其更改代码的结构,

首先,您需要为对话框创建一个单独的类(以便您可以在其上传递数据),

然后,您需要为这种“列表视图”图块创建自定义图块类。

然后,您需要在自定义对话框中创建列表视图,并在列表视图中调用这些磁贴。

在单击按钮时,只需在调用对话框时传递数据即可。