Commit 49a97a5f authored by “Icebear”'s avatar “Icebear”
parents 5f42161c 75beab40
import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/common/Images.dart';
import 'secondVC.dart';
class jssPageDemo extends StatelessWidget {
// const ({Key? key}) : super(key: key)
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("jss测试页面"),
),
body:Column(
children:[
RaisedButton(
onPressed:() {
Navigator.of(context).push(MaterialPageRoute(
builder: (context){
return twoVCdemo();
},
settings: RouteSettings(
name: "我是传过去的",
arguments:"参数,是对象类型",
)
),
);
},
child: Text("点击进入下一页,页面传值与返回。"),
),
textDemo(),
buttonDemo(),
imageiconDemo(),
]
)
);
return Container(
child: Column(
children: [
textDemo(),
buttonDemo(),
imageiconDemo(),
],
)
);
}
}
class twoVCdemo extends StatelessWidget {
// const ({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("jss测试页面"),
appBar: AppBar(
title: Text("jssDemo第二个页面的标题"),
),
body: Column(
children: [
IconButton(
icon: Icon(Icons.home),
onPressed:() {
Navigator.of(context).push(MaterialPageRoute(
builder: (context){
return nextViewDemo();
},
settings: RouteSettings(
name: "我是传过去的",
arguments:"参数,是对象类型",
),
body:Column(
children:[
ElevatedButton(
onPressed:() {
Navigator.of(context).push(MaterialPageRoute(
builder: (context){
return twoVCdemo();
},
settings: RouteSettings(
name: "我是传过去的名字",
arguments :"参数,是对象类型",
)
),
//是否有返回
maintainState: false,
//类似iOS ture 弹窗式推送界面 false 是push
fullscreenDialog: false,
);
},
child: Text("点击进入下一页,页面传值与返回。"),
),
);
},
textDemo(),
buttonDemo(),
imageiconDemo(),
]
)
),
],
),
);
}
}
class nextViewDemo extends StatelessWidget {
// const nextViewDemo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("jss测试第三界面"),
return Container(
),
body: Column(
children: [
RaisedButton(onPressed: () {
Navigator.of(context).pop(
"我传过来值了,这是一个对象类型"
);
},
child: Text("点击返回传值"),
),
],
),
child: Column(
children: [
textDemo(),
buttonDemo(),
imageiconDemo(),
],
)
);
}
}
class textDemo extends StatelessWidget {
// const ({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: Colors.blue,
child:Text (
"文本,我是个文本 woeijaoijfioasjfajfaojfoiasjfidsjfajf危机哦娃儿哦i啊就哦发i家阿减肥哦i阿减肥里挖掘佛i挖掘安抚啊发生放假啊师傅就撒就啊说",
maxLines: 10,
overflow: TextOverflow.ellipsis,
textDirection: TextDirection.ltr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.orange,
width: double.infinity,
color: Colors.blue,
child:Text (
"文本,我是个文本 woeijaoijfioasjfajfaojfoiasjfidsjfajf危机哦娃儿哦i啊就哦发i家阿减肥哦i阿减肥里挖掘佛i挖掘安抚啊发生放假啊师傅就撒就啊说",
maxLines: 10,
overflow: TextOverflow.ellipsis,
textDirection: TextDirection.ltr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.orange,
),
),
),
);
}
......@@ -161,7 +89,7 @@ class buttonDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
return Column(
children: [
RaisedButton(
onPressed: (){},
......@@ -172,9 +100,9 @@ class buttonDemo extends StatelessWidget {
child: Text("扁平按钮")
),
FlatButton.icon(
onPressed: (){},
icon: Icon(Icons.outbound),
label: Text("按钮"),
onPressed: (){},
icon: Icon(Icons.outbound),
label: Text("按钮"),
color: Colors.black,
textColor: Colors.white,
),
......@@ -182,11 +110,11 @@ class buttonDemo extends StatelessWidget {
child: Text("边框按钮"),
),
IconButton(
onPressed: (){},
icon: Icon(Icons.access_alarm),
onPressed: (){},
icon: Icon(Icons.access_alarm),
)
],
);
);
}
}
......@@ -206,7 +134,8 @@ class imageiconDemo extends StatelessWidget {
// Image.network("http://www.baidu.com/baidu.php?url=a00000KEJeCxDFezEVpFL9_MH8XSqbHklw_maA_-0O-JAG-gv2I-uvEAQqh-teALqpO_NZN1EbyMj5iOpf3Z1ZREUPx5_1lniEkZj6mijxFoM8VqoaPcH0KOxWwCyPbmri5Hlwk-A8u4pBUbGLW2x882fEua1eOAEbBWTdTqxEMA631a3yr2qBWOz88FPpAVsair-sXakr4y6eguntj86fZCDab3.DR_aOQZsYpb2glyIiUr2s1f_uQr1Fv20.U1Yk0ZDqVSXS_0KY5IissIpS_QMU8pi110KGUHY1PWT0Iybq0ZKGujYk0APGujY1rjc0mhbqn10k0AuY5H00TA6qn0KET1Ys0AFL5H00UMfqn0K1XWY0ThIYmyTqn0K8IM0qna3snj0snj0sn0K-ThTqn0KYTh7buHYdrH0knHm0mhwGujdKnWT1rj0sPHnLPYm1fHndrRmdrH64rjDkwjT3PHcsPsKbmvPb5fK9TdqGuAnqujcVmhwbX0KzIjY3P1T0TgKGujYs0Z7Wpyfqn0K9mWYsg100TZ0qn0KVIZ0qn0KbuAqs5H00ThCqn0KYIgnqnHT1P1DYnWD3P1nYP1RznWDYnW60mynqnfKsUWYs0ZK9I7qhUA7M5H00ugwGujYVnfK9TLKWm1Ys0ZNspy4Wm1Ys0AuWIgfqn0K9uAu_myTqnfKLuMFEUHY0mMfqnfKzug7Y5HDvnWRLnW64rHTvrjm0Tv-b5Hbsn16Lm179n1F9nHRvrj60ULfqn0KETMKY5H0WnaPDw-fWnansc10Wna3sc10WwDuRc10WwDuR0AVG5H00UgfqnWfkn0KVm1Ys0AdWgvuzUvYqn0Kbmy4dmhNxTAk9Uh-bT1Ys0A7bTgbqVSXS_0K9uZ7Y5H00pgPWUjYs0Z7VIjYs0A7bgLPEIgFWuHYsczn0mLFW5HRkrjcL",
// fit: BoxFit.fitWidth
// ),
Image.asset("ic_home_normal.png")
Image.asset(Images.ic_my_info),
],
);
return Container(
......@@ -215,5 +144,3 @@ class imageiconDemo extends StatelessWidget {
}
}
import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/common/Images.dart';
import 'thirdVC.dart';
class twoVCdemo extends StatelessWidget {
// const ({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("jssDemo第二个页面的标题"),
),
body: Column(
children: [
ElevatedButton(
child: Text("第二页面的按钮,跳转带参数过去"),
onPressed:() {
Navigator.of(context).push(MaterialPageRoute(
builder: (context){
return nextViewDemo();
},
settings: RouteSettings(
name: "我是传过去的",
arguments:"参数,是对象类型",
),
//是否有返回
maintainState: false,
//类似iOS ture 弹窗式推送界面 false 是push
fullscreenDialog: false,
),
);
},
),
Flex(direction:Axis.horizontal,
children: [
Image.asset(Images.ic_home_normal,alignment: Alignment.center,),
],
)
],
),
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
class nextViewDemo extends StatelessWidget {
// const nextViewDemo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("jss测试第三界面"),
),
body: Column(
children: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop(
"我传过来值了,这是一个对象类型"
);
},
child: Text("点击返回传值"),
),
],
),
);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:netrain_flutter_app/xuehao/car_details.dart';
import 'package:netrain_flutter_app/common/AppColors.dart';
import 'package:netrain_flutter_app/xuehao/grid_page.dart';
import 'package:netrain_flutter_app/xuehao/list_page.dart';
import 'laishanqi/Stateful_page.dart';
......@@ -16,7 +17,7 @@ import 'zhangfeng/CustomTabPage.dart';
import 'zhangfeng/TestPage.dart';
import 'zhangfeng/TabBarPage.dart';
import 'jishuaishuai/student.dart';
import 'jishuaishuai/firstVC.dart';
......@@ -56,8 +57,11 @@ class MyApp extends StatelessWidget {
"LoginRequestPage":(context) => LoginRequestPage(),
"PageView":(context) => SampleAppPage(),
"main": (context) => mainPage(),
"firstVC":(context) => jssPageDemo(),
"car_details":(context) =>CarDetailsPage(),
"student":(context) => jssPageDemo(),
"car_details":(context) =>CarDetailsPage()
"car_details":(context) =>CarDetailsPage(),
"grid_page":(context) =>GridPage()
},
),
onWillPop: () async {
......@@ -110,7 +114,9 @@ class _RouterNavigatorState extends State<RouterNavigator> {
_item("CustomTabPage",TabBarPage(),'CustomTabPage'),
_item("PageView",SampleAppPage(),'PageView'),
_item("listview页面",List_Page(),'listPage'),
_item("jssDemo", jssPageDemo(), 'student')
_item("jssDemo", jssPageDemo(), 'firstVC'),
_item("jssDemo", jssPageDemo(), 'student'),
_item("gridView",GridPage(),'grid_page')
],
),
);
......@@ -131,3 +137,4 @@ class _RouterNavigatorState extends State<RouterNavigator> {
);
}
}
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
/**
* @author xuehao
* on 2021/7/13
*/
class GridPage extends StatefulWidget {
GridPage({Key key}) : super(key: key);
@override
_GridPageState createState() => _GridPageState();
}
class _GridPageState extends State<GridPage> {
EasyRefreshController _controller = EasyRefreshController();
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "grid_page",
home: Scaffold(
appBar: AppBar(
title: Text("grid_page"),
),
body: EasyRefresh(
controller: _controller,
header: MaterialHeader(),
footer: PhoenixFooter(),
onRefresh: () async {
_refresh();
},
onLoad: () async {
_loadData();
},
child: GridView.builder(
///GridView配置项
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//设置每行最大显示数量
crossAxisCount: 3,
//横轴间距
crossAxisSpacing: 2.0,
//主轴间距
mainAxisSpacing: 2.0,
//宽高比
childAspectRatio: 0.7,
),
itemCount: _datas.length,
itemBuilder: (context, index) {
return _itemWidget(_datas[index]);
},
),
),
),
);
}
List<String> _datas = [
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
"https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg",
];
Future<void> _refresh() async {
Future.delayed(Duration(seconds: 2), () async {
setState(() {
for (int i = 0; i < _datas.length; i++) {
_datas[i] =
"https://img2.baidu.com/it/u=1852546487,3301595200&fm=11&fmt=auto&gp=0.jpg";
}
_controller.finishRefresh(success: true);
});
});
}
Future<void> _loadData() async {
Future.delayed(Duration(seconds: 2), () async {
setState(() {
for (int i = 0; i < 10; i++) {
_datas.add("https://img1.baidu.com/it/u=4241162085,3588743387&fm=26&fmt=auto&gp=0.jpg");
}
_controller.finishLoad(success: true);
});
});
}
Widget _itemWidget(String src) {
return new Image.network(src, fit: BoxFit.cover);
}
}
......@@ -56,23 +56,60 @@ class _ListPageState extends State<List_Page> with WidgetsBindingObserver {
);
}
void dispose() {
super.dispose();
WidgetsBinding.instance.removeObserver(this);
print("dispose");
}
//定义一个全局的变量:模型数组
List<Car> datas = [
Car(
name: '保时捷918 Spyder',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-7d8be6ebc4c7c95b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '兰博基尼Aventador',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-e3bfd824f30afaac?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '法拉利Enzo',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-a1d64cf5da2d9d99?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: 'Zenvo ST1',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-bf883b46690f93ce?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '迈凯伦F1',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-5a7b5550a19b8342?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '萨林S7',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-2e128d18144ad5b8?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '科尼赛克CCR',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-01ced8f6f95219ec?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '布加迪Chiron',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-7fc8359eb61adac0?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '轩尼诗Venom GT',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-d332bf510d61bbc2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '西贝尔Tuatara',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-3dd9a70b25ae6bc9?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
)
];
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
print("initState");
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
print(state);
}
///获取item视图
Widget _getDatas(int position) {
......@@ -131,56 +168,4 @@ class _ListPageState extends State<List_Page> with WidgetsBindingObserver {
}
}
//定义一个全局的变量:模型数组
List<Car> datas = [
Car(
name: '保时捷918 Spyder',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-7d8be6ebc4c7c95b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '兰博基尼Aventador',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-e3bfd824f30afaac?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '法拉利Enzo',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-a1d64cf5da2d9d99?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: 'Zenvo ST1',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-bf883b46690f93ce?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '迈凯伦F1',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-5a7b5550a19b8342?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '萨林S7',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-2e128d18144ad5b8?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '科尼赛克CCR',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-01ced8f6f95219ec?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '布加迪Chiron',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-7fc8359eb61adac0?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '轩尼诗Venom GT',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-d332bf510d61bbc2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
),
Car(
name: '西贝尔Tuatara',
imageUrl:
'https://upload-images.jianshu.io/upload_images/2990730-3dd9a70b25ae6bc9?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
)
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment