簡體   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