首页
Search
1
Linux 下 Bash 脚本 bad interpreter 报错的解决方法
71 阅读
2
Arch Linux 下解决 KDE Plasma Discover 的 Unable to load applications 错误
53 阅读
3
Arch Linux 下解决 KDE Plasma Discover 的 Unable to load applications 错误
42 阅读
4
如何在 Clash for Windows 上配置服务
40 阅读
5
如何在 IOS Shadowrocket 上配置服务
40 阅读
clash
服务器
javascript
全部
游戏资讯
登录
Search
加速器之家
累计撰写
1,061
篇文章
累计收到
0
条评论
首页
栏目
clash
服务器
javascript
全部
游戏资讯
页面
搜索到
1061
篇与
的结果
2024-08-22
futter页面跳转,列表跳转至详情页介绍
1、使用InkWell()包裹元素,onTap(){}点击跳转onTap: (){ Navigator.of(context).push( MaterialPageRoute(builder: (context)=>DetailPage( eachVodId: val['id'], eachVodName: val['vod_name'], p:1 )) ); }1.1、demo代码: return InkWell( onTap: (){ Navigator.of(context).push( MaterialPageRoute(builder: (context)=>DetailPage( eachVodId: val['id'], eachVodName: val['vod_name'], p:1 )) ); }, );2、引入详情页面,不然报错import 'detail_page.dart';3、详情页接受数据:3.1、接受数据:DetailPage({Key key, @required this.eachVodId, @required this.eachVodName, @required this.p, @required this.url}) : super(key: key);定义变量: final int eachVodId; final String eachVodName; final int p;3.2,、获取数据:widget.eachVodId;3.3、demo代码:import 'package:flutter/material.dart'; class DetailPage extends StatefulWidget{ DetailPage({Key key, @required this.eachVodId, @required this.eachVodName, @required this.p, @required this.url}) : super(key: key); final int eachVodId; final String eachVodName; final int p; _DetailState createState() => _DetailState(); } class _DetailState extends State<DetailPage> { @override void initState() { super.initState(); var map = Map(); map["id"] = widget.eachVodId; map["p"] = widget.p; } Widget build(BuildContext context) {} }
2024年08月22日
8 阅读
0 评论
0 点赞
2024-08-22
flutter页面间跳转和销毁方法
1、push方法:直接跳转到下个页面,可以传递参数Navigator.of(context).push( new MaterialPageRoute(builder: (BuildContext context) { //TextWdigetPage要跳转的页面 //title要传递的参数 return TextWdigetPage(title: "传递的参数"); })) ),或者Navigator.push(context, new MaterialPageRoute(builder: (BuildContext context) { return TextWdigetPage(title: "传递的参数"); }) )2、页面的销毁:跳转后的操作,route == null 为销毁当前页面Navigator.pushAndRemoveUntil(context, new MaterialPageRoute(builder: (BuildContext context) { return TextWdigetPage(title: "传递的参数"); }), (route) => route == null )
2024年08月22日
6 阅读
0 评论
0 点赞
2024-08-22
flutter搜索功能实现
搜索功能在每个app里面必不可少,也是常见的功能,以下是个案例。效果图展示:说明:本功能实现,点击搜索框跳转至搜索页面,搜索联想功能import 'package:flutter/material.dart'; import 'detail_page.dart'; class HomePage extends StatefulWidget{ _TvPageState createState() => _TvPageState(); } class _TvPageState extends State<HomePage> with AutomaticKeepAliveClientMixin{ @override void initState(){ super.initState(); } @override Widget build(BuildContext context){ // super.build(context); return Scaffold( backgroundColor: Color.fromRGBO(244, 245, 245, 1), appBar: AppBar( title: Container( child:InkWell( onTap: (){ showSearch(context: context, delegate: CustomSearchDelegate()); //实现点击跳转至搜索页面 }, child: Row( children: <Widget>[ Container( child: Text( '广州', style: TextStyle(fontSize: 14), ), ), Container( width: ScreenUtil().setWidth(50), child: Icon( Icons.expand_more, color: Colors.white, size:20 ), ), Container( width: ScreenUtil().setWidth(515), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(50.0)), ), height: 30, child: Row( children: <Widget>[ Container( width: ScreenUtil().setWidth(60), child: Icon( Icons.search, color: Colors.grey, size:20 ) ), Container( width: ScreenUtil().setWidth(400), child: Text( '影视名称/主演', style: TextStyle(color: Colors.black,fontSize: 16), ), ), Container( width: ScreenUtil().setWidth(50), child: Icon( Icons.mic, color: Colors.grey, size:20 ), ) ], ) ), ], ), ), ) ), ); } //搜索 class CustomSearchDelegate extends SearchDelegate { @override List<Widget> buildActions(BuildContext context) { return [ IconButton( tooltip: 'Clear', icon: const Icon(Icons.clear), onPressed: () { query = ''; showSuggestions(context); }, ) ]; } @override String get searchFieldLabel => "影视名称/主演"; Widget buildLeading(BuildContext context) { return IconButton( tooltip: 'Back', icon: AnimatedIcon( icon: AnimatedIcons.menu_arrow, progress: transitionAnimation, ), onPressed: () { this.close(context, null); }, ); } @override TextInputType get keyboardType => TextInputType.text; //设置输入框输入内容类型 @override Widget buildResults(BuildContext context) { // if (int.parse(query) >= 100) { // return Center(child: Text('请输入小于 100 的数字')); // } var map = Map(); map["query"] = query; return Scaffold( body: FutureBuilder( future: request('gsearchs',formData: map), builder: (context,AsyncSnapshot snapshot) { if(snapshot.connectionState ==ConnectionState.done){ if(snapshot.hasData){ var data = json.decode(snapshot.data.toString()); return ListView.builder( itemCount: List.of(data["data"]).length, itemBuilder: (BuildContext context, int index) { return InkWell( onTap: (){ Navigator.of(context).push( MaterialPageRoute(builder: (context)=>DetailPage( eachVodId: List.of(data["data"])[index]['id'], eachVodName:List.of(data["data"])[index]['vod_name'], p:1 )) ); }, child:ListTile(title: Text(List.of(data["data"])[index]['vod_name'])), ); } ); }else{ return Center(child: CircularProgressIndicator()); } }else{ return Center(child: CircularProgressIndicator()); } }) ); } @override Widget buildSuggestions(BuildContext context) { var map = Map(); map["query"] = query; return Scaffold( body: FutureBuilder( future: request('gsearchs',formData: map), builder: (context, snapshot) { if(snapshot.connectionState ==ConnectionState.done){ if(snapshot.hasData){ var data = json.decode(snapshot.data.toString()); return ListView.builder( itemCount: List.of(data["data"]).length, itemBuilder: (BuildContext context, int index) { return InkWell( onTap: (){ Navigator.of(context).push( MaterialPageRoute(builder: (context)=>DetailPage( eachVodId: List.of(data["data"])[index]['id'], eachVodName:List.of(data["data"])[index]['vod_name'], p:1 )) ); }, child:ListTile(title: Text(List.of(data["data"])[index]['vod_name'])), ); } ); }else{ return Center(child: CircularProgressIndicator()); } }else{ return Center(child: CircularProgressIndicator()); } }) ); } }
2024年08月22日
4 阅读
0 评论
0 点赞
2024-08-22
flutter常见命令整理收藏
1、帮助命令:flutter -h2、显示本机的模拟器:flutter emulators3、启动本机的模拟器:flutter emulator --launch apple_ios_simulator4、远程更新package:flutter packages get5、运行应用到模拟器上:flutter run6、热重载:先保存代码ctrl+s,,然后在 terminal中输入r,执行后界面内容更新7、停止运行:ctrl+zVSCode中常用的快捷键R 键重新启动r 键热重载q 退出p 显示网格P 显示帧率o 切换Android与iOS的预览模式
2024年08月22日
5 阅读
0 评论
0 点赞
2024-08-22
解决Android studio 创建虚拟机时提示a system image must be selected continue问题
在使用android studio的时候,很多新手在创建虚拟机的时候回出现 a system image must be selected continue错误。里明显是缺少了systemImage,解决方法如下打开SDK MANAGER,然后把右下角的show package details勾上,把对应的system image下载下来即可
2024年08月22日
15 阅读
0 评论
0 点赞
1
...
168
169
170
...
213