Hello Flutter!
作者:互联网
体验一下Flutter。
import 'package:flutter/material.dart'; void main() => runApp(new HelloWorldApp()); class HelloWorldApp extends StatelessWidget { @override Widget build(BuildContext context) { // TODO: implement build return MaterialApp( debugShowCheckedModeBanner: false, title: "Hello World", home: Scaffold( appBar: AppBar( title: Text("Hello World Travel App"), backgroundColor: Colors.deepPurple, ), body: Builder( builder: (context) => SingleChildScrollView( child: Padding( padding: EdgeInsets.all(20), child: Center( child: Column( children: [ Padding( padding: EdgeInsets.all(10), child: Text( 'Hello World Travel', style: TextStyle( fontSize: 26, fontWeight: FontWeight.bold, color: Colors.blue[800]), ), ), Padding( padding: EdgeInsets.all(5), child: Text( 'Discover the World', style: TextStyle( fontSize: 20, color: Colors.deepPurpleAccent, ), ), ), Padding( padding: EdgeInsets.all(25), child: Container( decoration: BoxDecoration(boxShadow: [ BoxShadow( color: Colors.blue, blurRadius: 10, spreadRadius: 2) ]), child: Image.network( 'https://images.freeimages.com/images/large-previews/eaa/the-beach-1464354.jpg', height: 350, )), ), Padding( padding: EdgeInsets.all(25), child: RaisedButton( child: Text('Contacts'), onPressed: () => print('Contact us')), ), ], )), ), ), ), ), ); } void contactUs(BuildContext context) { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Contact me'), content: Text('Mail us at hello@world.com'), actions: <Widget>[ FlatButton( child: Text('Close'), onPressed: () => Navigator.of(context).pop(), ) ], ); }); } }
标签:padding,Text,Flutter,Padding,context,child,EdgeInsets,Hello 来源: https://www.cnblogs.com/JasonPeng1/p/14220743.html