-
main.dart
代码:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Text widget',
home: Scaffold(
body: Center(
child:Container(
child: new Text('Hello World!',style:TextStyle(fontSize: 40.0,color: Colors.white)),
alignment: Alignment.center,
width: 500.0,
height: 400.0,
padding: const EdgeInsets.fromLTRB(10.0, 20.0, 0.0, 20.0),
margin: const EdgeInsets.all(10.0),
decoration: new BoxDecoration(
gradient: const LinearGradient(
colors: [Colors.lightBlueAccent,Colors.greenAccent,Colors.purple]
),
border: Border.all(width: 1.0,color: Colors.pink) // 边框
),
)
)
),
);
}
}
效果:
image.png
网友评论