flutter-登录

flutter-登录_第1张图片
Screenshot_20190701-173143.jpg
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: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Center(
            child: Text('登录页面'),
          ),
        ),

        body: Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            Padding(
                padding: EdgeInsets.all(16),
                child: Image.asset('images/icon_lau.jpeg',fit: BoxFit.fill,scale: 2,),
            ),
            Padding(
                padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 15.0),
                child:  Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    Padding(padding: EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0),
                      child: Image.asset('images/icon_user.jpg',width: 40,height: 40,fit: BoxFit.fill,),
                    ),
                    Expanded(
                        child: TextField(
                          decoration: InputDecoration(
                            helperText: '请输入用户名',
                          ),
                        )
                    ),
                  ],
                )
            ),
            Padding(
                padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 15.0),
                child:  Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    Padding(padding: EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0),
                      child: Image.asset('images/icon_pass.jpg',width: 40,height: 40,fit: BoxFit.fill,),
                    ),
                    Expanded(
                        child: TextField(
                          decoration: InputDecoration(
                            helperText: '请输密码',
                          ),
                          obscureText: true,
                        )
                    ),
                  ],
                )
            ),
            Container(
              width: 300,
              child: Card(
                color: Colors.blue,
                elevation: 16.0,
                child: Center(
                  child: MaterialButton(onPressed: (){
                    print('疯狂登录吧');
                  },child: Text('登录'),),
                )
              ),
            ),
          ],
        ),
      )
    );
  }
}

你可能感兴趣的:(flutter-登录)