繁体   English   中英

如何使用 flutter 构建此屏幕的白色区域?

[英]how can i build white region of this screen using flutter?

我是 Flutter 框架的新手,我想创建以下活动,我知道如何创建活动永久区域但我不知道这个屏幕的白色部分,这个屏幕中使用的小部件是什么,请指导我如何我可以使用 Flutter 创建这部分吗?

在此处输入图像描述

这是我的代码

    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(),
        );
      }
    }

试试这个例子

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
              );
            },
          ),
        ),
      ),
    );
  }
}

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

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

关于电话你可以使用这个 package url_launche

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM