first commit
This commit is contained in:
1
滴滴淘/ddt_flutter/lib/view/page/.pydio
Normal file
1
滴滴淘/ddt_flutter/lib/view/page/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
6a9bf672-8ca9-43f0-a84b-66e4871ed6e8
|
||||
44
滴滴淘/ddt_flutter/lib/view/page/about.dart
Executable file
44
滴滴淘/ddt_flutter/lib/view/page/about.dart
Executable file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_app/R.dart';
|
||||
class About extends StatelessWidget {
|
||||
|
||||
// final title;
|
||||
// About({ this.title });
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0.0,
|
||||
title: Text("我的"),
|
||||
),
|
||||
body: new Container(
|
||||
color: Colors.orange,
|
||||
height: 250.0,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: new Column(
|
||||
verticalDirection: VerticalDirection.down,
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Image.asset(
|
||||
R.libStaticImgLogoPng,
|
||||
width: 80.0,
|
||||
height: 80.0,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
],
|
||||
),
|
||||
new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text("我的")
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
48
滴滴淘/ddt_flutter/lib/view/page/help.dart
Executable file
48
滴滴淘/ddt_flutter/lib/view/page/help.dart
Executable file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class Help extends StatefulWidget {
|
||||
@override
|
||||
_Help createState() => _Help();
|
||||
}
|
||||
|
||||
class _Help extends State<Help> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: new Text(
|
||||
"帮助"
|
||||
),
|
||||
),
|
||||
body: new Center(
|
||||
child: new RaisedButton(
|
||||
child: new Text("点我"),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return SimpleDialog(
|
||||
title: new Text("测试"),
|
||||
children: <Widget>[
|
||||
SimpleDialogOption(
|
||||
child: new Image.asset(
|
||||
"lib/static/img/logo.png",
|
||||
width: 80.0,
|
||||
height: 80.0,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SimpleDialogOption(
|
||||
child: const Text('你好2'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
203
滴滴淘/ddt_flutter/lib/view/page/home.dart
Executable file
203
滴滴淘/ddt_flutter/lib/view/page/home.dart
Executable file
@@ -0,0 +1,203 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_app/view/page/help.dart';
|
||||
|
||||
import 'package:flutter_app/config/index.dart';
|
||||
|
||||
import 'package:flutter_app/event/themeChangeEvent.dart';
|
||||
import 'package:flutter_app/event/indexLayoutChangeEvent.dart';
|
||||
import 'package:flutter_app/common/Application.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flutter_app/R.dart';
|
||||
import 'package:flutter_app/model/IndexModel.dart';
|
||||
//import 'package:flutter_app/view/components/ListWidget.dart';
|
||||
|
||||
import 'package:flutter_app/service/service.dart';
|
||||
import 'package:flutter_refresh/flutter_refresh.dart';
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
@override
|
||||
_Home createState() => _Home();
|
||||
}
|
||||
|
||||
//
|
||||
class _Home extends State<Home> with AutomaticKeepAliveClientMixin<Home> {
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
List<Body> modules = [];
|
||||
int page = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// getData();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
getData() async {
|
||||
this.page += 1;
|
||||
Index data = await ServiceMethods().getImageList({ "page": this.page });
|
||||
setState(() {
|
||||
modules = data.body;
|
||||
});
|
||||
print(this.modules);
|
||||
}
|
||||
|
||||
Future<Null> onFooterRefresh() {
|
||||
return new Future.delayed(new Duration(seconds: 2), () {
|
||||
getData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<Null> onHeaderRefresh() {
|
||||
return new Future.delayed(new Duration(seconds: 2), () {
|
||||
print("上拉");
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: appBars(),
|
||||
body: Container(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
this.getData();
|
||||
},
|
||||
child: new Text(
|
||||
'测试',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)
|
||||
),
|
||||
drawer: drawers()
|
||||
);
|
||||
}
|
||||
|
||||
// 主体内容区域
|
||||
// ignore: non_constant_identifier_names
|
||||
// Widget BodyLayout () {
|
||||
// return new Refresh(
|
||||
// onFooterRefresh: onFooterRefresh,
|
||||
// onHeaderRefresh: onHeaderRefresh,
|
||||
// childBuilder: (BuildContext context, { ScrollController controller, ScrollPhysics physics }) {
|
||||
// return new ListWidget(modules,controller,physics);
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
// 顶部appbar
|
||||
Widget appBars() {
|
||||
return AppBar(
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.help_outline),
|
||||
tooltip: '关于',
|
||||
onPressed: () {
|
||||
Navigator.push(context,new MaterialPageRoute(
|
||||
builder:(context) => new Help())
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text('精选美图'),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Config.indexLayout == "default" ? Icon(Icons.subject) : Icon(Icons.border_all),
|
||||
tooltip: '切换布局',
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (Config.indexLayout == "default") {
|
||||
Config.indexLayout = "twoColumn";
|
||||
}else {
|
||||
Config.indexLayout = "default";
|
||||
}
|
||||
changeIndexLayout();
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 抽屉侧边栏
|
||||
Widget drawers() {
|
||||
return new Drawer(
|
||||
child: new ListView(
|
||||
padding: new EdgeInsets.all(0.0),
|
||||
children: <Widget>[
|
||||
new UserAccountsDrawerHeader(
|
||||
accountName: new Text(
|
||||
'编码猿',
|
||||
style: new TextStyle( fontWeight: FontWeight.bold ),
|
||||
), //用户名
|
||||
accountEmail: new Text('2271608011@qq.com'), //用户邮箱
|
||||
currentAccountPicture: new GestureDetector( //用户头像
|
||||
onTap: () => print('current user'),
|
||||
child: new CircleAvatar( //圆形图标控件
|
||||
backgroundImage: new AssetImage(
|
||||
R.libStaticImgLogoPng
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: new BoxDecoration( //用一个BoxDecoration装饰器提供背景图片
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.fill,
|
||||
image: new ExactAssetImage(R.libStaticImgShopJpg),
|
||||
),
|
||||
),
|
||||
),
|
||||
new ListTile(
|
||||
title: new Text('设置中心'),
|
||||
leading: new Icon(Icons.settings),
|
||||
),
|
||||
new ListTile(
|
||||
title: Text(Config.dark ? "日间模式" : "夜间模式"),
|
||||
leading: new Icon(Icons.brightness_2),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (Config.dark == true) {
|
||||
Config.dark = false;
|
||||
} else {
|
||||
Config.dark = true;
|
||||
}
|
||||
print(Config.dark);
|
||||
changeTheme();
|
||||
});
|
||||
},
|
||||
),
|
||||
new ListTile( //第二个功能项
|
||||
title: new Text('关于我'),
|
||||
leading: new Icon(Icons.account_circle),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed('/about');
|
||||
},
|
||||
),
|
||||
new Divider(), //分割线控件
|
||||
new ListTile( //退出按钮
|
||||
title: new Text('关闭'),
|
||||
leading: new Icon(Icons.cancel),
|
||||
onTap: () => Navigator.of(context).pop(), //点击后收起侧边栏
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
changeIndexLayout() async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
sp.setString("indexLayout", Config.indexLayout);
|
||||
Application.eventBus.fire(new indexLayoutChangeEvent(Config.indexLayout));
|
||||
}
|
||||
|
||||
changeTheme() async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
sp.setBool("themeIndex", Config.dark);
|
||||
Application.eventBus.fire(new themeChangeEvent(Config.dark));
|
||||
}
|
||||
|
||||
}
|
||||
28
滴滴淘/ddt_flutter/lib/view/page/like.dart
Executable file
28
滴滴淘/ddt_flutter/lib/view/page/like.dart
Executable file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Like extends StatefulWidget {
|
||||
@override
|
||||
_Like createState() => _Like();
|
||||
}
|
||||
|
||||
class _Like extends State<Like> {
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar:AppBar(
|
||||
title: Text('喜欢'),
|
||||
),
|
||||
body:Center(
|
||||
child: Text('喜欢'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
191
滴滴淘/ddt_flutter/lib/view/page/login.dart
Normal file
191
滴滴淘/ddt_flutter/lib/view/page/login.dart
Normal file
@@ -0,0 +1,191 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:extended_tabs/extended_tabs.dart';
|
||||
|
||||
class Login extends StatefulWidget {
|
||||
@override
|
||||
_Login createState() => _Login();
|
||||
}
|
||||
|
||||
class _Login extends State<Login> with TickerProviderStateMixin{
|
||||
TabController tabController;
|
||||
|
||||
//表单状态
|
||||
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
|
||||
//用户名输入框控制器,此控制器可以监听用户名输入框操作
|
||||
TextEditingController _userNameController = new TextEditingController();
|
||||
|
||||
//焦点
|
||||
FocusNode _focusNodeUserName = new FocusNode();
|
||||
FocusNode _focusNodePassWord = new FocusNode();
|
||||
|
||||
var _password = '';//用户名
|
||||
var _username = '';//密码
|
||||
var _isShowPwd = false;//是否显示密码
|
||||
var _isShowClear = false;//是否显示输入框尾部的清除按钮
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
tabController = TabController(length: 2, vsync: this);
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Flex(
|
||||
direction: Axis.vertical,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 250,
|
||||
color: Colors.red[500],
|
||||
),
|
||||
Container(
|
||||
color: Colors.red[500],
|
||||
child: TabBar(
|
||||
indicator: ColorTabIndicator(Colors.red[500]),
|
||||
labelColor: Colors.white,
|
||||
tabs: [
|
||||
Tab(
|
||||
child: Text(
|
||||
'登录',
|
||||
style: TextStyle(
|
||||
fontSize: 18
|
||||
)
|
||||
),
|
||||
),
|
||||
Tab(
|
||||
child: Text(
|
||||
'注册',
|
||||
style: TextStyle(
|
||||
fontSize: 18
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
controller: tabController,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ExtendedTabBarView(
|
||||
controller: tabController,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20,right: 20),
|
||||
decoration: new BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
color: Colors.white
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
new TextFormField(
|
||||
controller: _userNameController,
|
||||
focusNode: _focusNodeUserName,
|
||||
//设置键盘类型
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
labelText: "手机号",
|
||||
hintText: "请输入手机号",
|
||||
prefixIcon: Icon(Icons.local_phone),
|
||||
//尾部添加清除按钮
|
||||
suffixIcon:(_isShowClear)
|
||||
? IconButton(
|
||||
icon: Icon(Icons.clear),
|
||||
onPressed: (){
|
||||
// 清空输入框内容
|
||||
_userNameController.clear();
|
||||
},
|
||||
)
|
||||
: null ,
|
||||
),
|
||||
//验证用户名
|
||||
validator: validateUserName,
|
||||
//保存数据
|
||||
onSaved: (String value){
|
||||
_username = value;
|
||||
},
|
||||
),
|
||||
new TextFormField(
|
||||
controller: _userNameController,
|
||||
focusNode: _focusNodeUserName,
|
||||
//设置键盘类型
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
decoration: InputDecoration(
|
||||
labelText: "密码",
|
||||
hintText: "请输入密码",
|
||||
prefixIcon: Icon(Icons.lock),
|
||||
//尾部添加清除按钮
|
||||
suffixIcon:(_isShowClear)
|
||||
? IconButton(
|
||||
icon: Icon(Icons.clear),
|
||||
onPressed: (){
|
||||
// 清空输入框内容
|
||||
_userNameController.clear();
|
||||
},
|
||||
)
|
||||
: null ,
|
||||
),
|
||||
//验证用户名
|
||||
validator: validateUserName,
|
||||
//保存数据
|
||||
onSaved: (String value){
|
||||
_username = value;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container()
|
||||
],
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
// body: Stack(
|
||||
// children: <Widget>[
|
||||
// Container(
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: 250,
|
||||
// color: Colors.red[500],
|
||||
// ),
|
||||
// Positioned(
|
||||
//
|
||||
// child: Text('测试'),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// body: Container(
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: 250,
|
||||
// color: Colors.red[500],
|
||||
// child: Row(
|
||||
// children: <Widget>[
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户名
|
||||
*/
|
||||
String validateUserName(value){
|
||||
// 正则匹配手机号
|
||||
RegExp exp = RegExp(r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
|
||||
if (value.isEmpty) {
|
||||
return '用户名不能为空!';
|
||||
}else if (!exp.hasMatch(value)) {
|
||||
return '请输入正确手机号';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
65
滴滴淘/ddt_flutter/lib/view/page/style.dart
Executable file
65
滴滴淘/ddt_flutter/lib/view/page/style.dart
Executable file
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_app/R.dart';
|
||||
|
||||
class Style extends StatefulWidget {
|
||||
@override
|
||||
_Style createState() => _Style();
|
||||
}
|
||||
|
||||
|
||||
class _Style extends State<Style> with AutomaticKeepAliveClientMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar:AppBar(
|
||||
title: Text('分类'),
|
||||
elevation: 0.0,
|
||||
),
|
||||
body: new Container(
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 120.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey,
|
||||
image: DecorationImage(
|
||||
image: AssetImage(R.libStaticImgClassallPng),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"全 部",
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white70
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new Text("dddd")
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user