flutter studioを利用する
https://flutterstudio.app/
source codeに変換する
import 'package:flutter/material.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Generated App', theme: new ThemeData( primarySwatch: Colors.blue, primaryColor: const Color(0xFF2196f3), accentColor: const Color(0xFF2196f3), canvasColor: const Color(0xFFfafafa), ), home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key}) : super(key: key); @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('App Name'), ), body: new Text( "Hello Flutter!", style: new TextStyle(fontSize:32.0, color: const Color(0xFF000000), fontWeight: FontWeight.w700, fontFamily: "Roboto"), ), ); } }
Center
import 'package:flutter/material.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Generated App', theme: new ThemeData( primarySwatch: Colors.blue, primaryColor: const Color(0xFF2196f3), accentColor: const Color(0xFF2196f3), canvasColor: const Color(0xFFfafafa), ), home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key}) : super(key: key); @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('App Name'), ), body: new Center( child: new Text( "qWerty1", style: new TextStyle(fontSize:12.0, color: const Color(0xFF000000), fontWeight: FontWeight.w200, fontFamily: "Roboto"), ), ), ); } }
Column
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('App Name'), ), body: new Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ new Text( "one", style: new TextStyle(fontSize:12.0, color: const Color(0xFF000000), fontWeight: FontWeight.w200, fontFamily: "Roboto"), ) ] ), ); } }