如何使用颤动建立此屏幕的白色区域?

时间:2020-08-15 09:12:09

标签: android android-studio flutter user-interface dart

我是Flutter框架的新手,我想创建以下活动,我知道如何创建“活动”永久区域,但是我不了解该屏幕的白色部分,请问该屏幕中使用的小部件是什么?指导我如何使用Flutter创建此部分?

enter image description here

这是我的代码

    import 'package:flutter/material.dart';
    
    import 'bottomnavigationbar.dart';
    
    class Contact extends StatefulWidget {
      @override
      _ContactState createState() => _ContactState();
    }
    
    class _ContactState extends State<Contact> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text("Contact"),
          ),
    
          body: Container(
    
            padding: EdgeInsets.all(1),
            color: Colors.black,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                Container(
                  width: MediaQuery.of(context).size.width,
                  height: MediaQuery.of(context).size.width/1.6,
                //  constraints: BoxConstraints.expand(),
                  decoration: BoxDecoration(
                    image: DecorationImage(
                        image: AssetImage("images/contactpage.png"),
                        fit: BoxFit.cover),
                  ),
                ),
                Padding(
                  padding: EdgeInsets.all(8),
                ),
                Text(
                  "Contact Info",
                  style: TextStyle(
                    color: Colors.red,
                    fontSize: 20,
                    fontWeight: FontWeight.w400,
                  ),
                ),
                Padding(
                  padding: EdgeInsets.all(8),
                ),
                Divider(
                  color: Colors.white,
                  indent: 40,
                  endIndent: 40,
                ),
              ],
            ),
          ),
          bottomNavigationBar: BottomNavigation(),
        );
      }
    }

1 个答案:

答案 0 :(得分:1)

尝试这个例子

import 'package:flutter/material.dart';

class UsingAlertDialog extends StatefulWidget{
  @override
  UsingAlertDialogState createState()=> new UsingAlertDialogState();
}

class UsingAlertDialogState extends State<UsingAlertDialog>{
  AlertDialog dialog = new AlertDialog(
    content: new Text(
      "I'm a AlertDialog",
      style: new TextStyle(fontSize: 30.0),
    ),
  );
  @override
  Widget build(BuildContext context){
    return Scaffold(
      appBar: new AppBar(
        title: new Text("Using Alert Dialog"),
      ),
      body: new Container(
        child: new Center(
          child: new RaisedButton(
            child: new Text("Touch Me"),
            onPressed: (){
              showDialog(
                context: context,
                builder: (BuildContext context)=>dialog
              );
            },
          ),
        ),
      ),
    );
  }
}

==========更新=======

模型组件可以是自定义对话框 SimpleDialog

关于电话,您可以使用此套餐 url_launche