mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-08-24 02:46:57 +08:00
Modfiy: 调整栏目
This commit is contained in:
18
README.md
18
README.md
@ -22,7 +22,25 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en.
|
|||||||
|
|
||||||
<img src="https://img.alicdn.com/tfs/TB19UahQQzoK1RjSZFlXXai4VXa-1500-1106.png" width="600px">
|
<img src="https://img.alicdn.com/tfs/TB19UahQQzoK1RjSZFlXXai4VXa-1500-1106.png" width="600px">
|
||||||
|
|
||||||
|
## 运行方式
|
||||||
|
|
||||||
|
- 查看一下版本号是否正确
|
||||||
|
```dart
|
||||||
|
flutter --version
|
||||||
|
```
|
||||||
|
- 运行以下命令查看是否需要安装其它依赖项来完成安装
|
||||||
|
```dart
|
||||||
|
flutter doctor
|
||||||
|
```
|
||||||
|
- 运行启动您的应用
|
||||||
|
```dart
|
||||||
|
flutter packages get
|
||||||
|
flutter run
|
||||||
|
```
|
||||||
|
|
||||||
|
- 如果有其他问题,请参考
|
||||||
|
- https://flutterchina.club/setup-macos/
|
||||||
|
- https://flutter.dev/docs/get-started/install/macos
|
||||||
|
|
||||||
## Release安装包下载地址
|
## Release安装包下载地址
|
||||||
|
|
||||||
|
@ -174,6 +174,7 @@ class _ListRefreshState extends State<ListRefresh> {
|
|||||||
return widget.renderItem(index, items[index]);
|
return widget.renderItem(index, items[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
),
|
),
|
||||||
|
@ -50,7 +50,9 @@ class FirstPageState extends State<FirstPage> with AutomaticKeepAliveClientMixin
|
|||||||
|
|
||||||
|
|
||||||
Future<Map> getIndexListData([Map<String, dynamic> params]) async {
|
Future<Map> getIndexListData([Map<String, dynamic> params]) async {
|
||||||
const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438';
|
/// const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438';
|
||||||
|
const juejin_flutter = 'https://fluttergo.pub:9527/juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438';
|
||||||
|
|
||||||
var pageIndex = (params is Map) ? params['pageIndex'] : 0;
|
var pageIndex = (params is Map) ? params['pageIndex'] : 0;
|
||||||
final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'};
|
final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'};
|
||||||
var responseList = [];
|
var responseList = [];
|
||||||
|
@ -6,18 +6,24 @@ import './sub_page.dart';
|
|||||||
import './main_app_bar.dart';
|
import './main_app_bar.dart';
|
||||||
import './search_page.dart';
|
import './search_page.dart';
|
||||||
import 'package:flutter_go/model/user_info.dart';
|
import 'package:flutter_go/model/user_info.dart';
|
||||||
|
import 'package:flutter_go/routers/application.dart' show Application;
|
||||||
|
import 'package:flutter_go/routers/routers.dart' show Routes;
|
||||||
|
|
||||||
|
DefaultTabController _tabController;
|
||||||
|
TabBar _tabBar;
|
||||||
|
|
||||||
class _Page {
|
class _Page {
|
||||||
final String labelId;
|
final String labelId;
|
||||||
|
final int labelIndex;
|
||||||
|
|
||||||
_Page(this.labelId);
|
_Page(this.labelId,this.labelIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<_Page> _allPages = <_Page>[
|
final List<_Page> _allPages = <_Page>[
|
||||||
_Page('项目1'),
|
_Page('热门资讯', 1),
|
||||||
_Page('项目2'),
|
_Page('FG-官网', 2),
|
||||||
_Page('项目3'),
|
_Page('FG-web版', 3),
|
||||||
_Page('项目4'),
|
///_Page('项目4'),
|
||||||
];
|
];
|
||||||
|
|
||||||
class MainPage extends StatelessWidget {
|
class MainPage extends StatelessWidget {
|
||||||
@ -27,12 +33,12 @@ class MainPage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print("MainPagess build......");
|
print("MainPagess build......");
|
||||||
return DefaultTabController(
|
_tabController = DefaultTabController(
|
||||||
length: _allPages.length,
|
length: _allPages.length,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: new MyAppBar(
|
appBar: MyAppBar(
|
||||||
leading: Container(
|
leading: Container(
|
||||||
child: new ClipOval(
|
child: ClipOval(
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
userInfo.id == 0?'https://hbimg.huabanimg.com/9bfa0fad3b1284d652d370fa0a8155e1222c62c0bf9d-YjG0Vt_fw658':userInfo.avatarPic,
|
userInfo.id == 0?'https://hbimg.huabanimg.com/9bfa0fad3b1284d652d370fa0a8155e1222c62c0bf9d-YjG0Vt_fw658':userInfo.avatarPic,
|
||||||
scale: 15.0,
|
scale: 15.0,
|
||||||
@ -54,10 +60,8 @@ class MainPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: TabBarViewLayout(),
|
body: TabBarViewLayout(),
|
||||||
// drawer: Drawer(
|
|
||||||
// child: MainLeftPage(),
|
|
||||||
// ),
|
|
||||||
));
|
));
|
||||||
|
return _tabController;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,37 +70,93 @@ void pushPage(BuildContext context, Widget page, {String pageName}) {
|
|||||||
Navigator.push(context, CupertinoPageRoute<void>(builder: (ctx) => page));
|
Navigator.push(context, CupertinoPageRoute<void>(builder: (ctx) => page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showAlertDialog(BuildContext context) {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false, // user must tap button!
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
//title: Text('免责声明'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(5.0, 5.0, 10.0, 10.0),
|
||||||
|
//width: 100,
|
||||||
|
height: 35,
|
||||||
|
child: Text('免责声明',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w700)),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
//color: Colors.blue,
|
||||||
|
image: DecorationImage(
|
||||||
|
fit: BoxFit.fitWidth,
|
||||||
|
image: AssetImage('assets/images/paimaiLogo.png')),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
//alignment: Alignment.bottomRight,
|
||||||
|
)),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
Text('111111111'),
|
||||||
|
Text('222222222'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: new BorderRadius.circular(20.0)), // 圆角
|
||||||
|
|
||||||
|
actions: <Widget>[
|
||||||
|
new Container(
|
||||||
|
width: 250,
|
||||||
|
/// child: _create(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class TabLayout extends StatelessWidget {
|
class TabLayout extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TabBar(
|
_tabBar = TabBar(
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
//labelPadding: EdgeInsets.all(12.0),
|
//labelPadding: EdgeInsets.all(12.0),
|
||||||
labelPadding: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0),
|
labelPadding: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0),
|
||||||
indicatorSize: TabBarIndicatorSize.label,
|
indicatorSize: TabBarIndicatorSize.label,
|
||||||
tabs: _allPages
|
tabs: _allPages.map((_Page page) => Tab(text: page.labelId)).toList(),
|
||||||
.map((_Page page) =>
|
onTap: (index) {
|
||||||
Tab(text: page.labelId))
|
if (index == 1) {
|
||||||
.toList(),
|
DefaultTabController.of(context).animateTo(0);
|
||||||
|
Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent('Flutter Go 官方网站')}&url=${Uri.encodeComponent('https://flutter-go.pub')}');
|
||||||
|
} else if (index == 2) {
|
||||||
|
|
||||||
|
// new Future.delayed(const Duration(seconds: 1),(){
|
||||||
|
// showAlertDialog(Application.globalContext);
|
||||||
|
// });
|
||||||
|
|
||||||
|
DefaultTabController.of(context).animateTo(0);
|
||||||
|
Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent('Flutter Go web版(H5)')}&url=${Uri.encodeComponent('https://flutter-go.pub/flutter_go_web')}');
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
return _tabBar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TabBarViewLayout extends StatelessWidget {
|
class TabBarViewLayout extends StatelessWidget {
|
||||||
Widget buildTabView(BuildContext context, _Page page) {
|
Widget buildTabView(BuildContext context, _Page page) {
|
||||||
String labelId = page.labelId;
|
int labelIndex = page.labelIndex;
|
||||||
switch (labelId) {
|
switch (labelIndex) {
|
||||||
case '项目1':
|
case 1:
|
||||||
return FirstPage();
|
return FirstPage();
|
||||||
break;
|
break;
|
||||||
case '项目2':
|
case 2:
|
||||||
return SubPage();
|
return Container(child:Text('1'));
|
||||||
break;
|
break;
|
||||||
case '项目3':
|
case 3:
|
||||||
return SubPage();
|
return Container(child:Text('2'));
|
||||||
break;
|
|
||||||
case '项目4':
|
|
||||||
return SubPage();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return Container();
|
return Container();
|
||||||
|
@ -23,7 +23,7 @@ final _industryPage = Industry.IndustryPage(itemTitle: (state){
|
|||||||
),
|
),
|
||||||
subtitle: Text(state.res[index].source),
|
subtitle: Text(state.res[index].source),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。
|
// 在这里对选中的结果进行解析
|
||||||
print(state.res[index].source);
|
print(state.res[index].source);
|
||||||
final itemTitle = state.res[index].title;
|
final itemTitle = state.res[index].title;
|
||||||
final itemUrl = state.res[index].source;
|
final itemUrl = state.res[index].source;
|
||||||
@ -44,7 +44,7 @@ class SearchPage extends StatelessWidget {
|
|||||||
/// print('suggestion::${Industry.suggestion}');
|
/// print('suggestion::${Industry.suggestion}');
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: Size(double.infinity, 52), // 44 is the height
|
preferredSize: Size(double.infinity, 52), // is the height
|
||||||
child: AppBar(title: searchBarPage)
|
child: AppBar(title: searchBarPage)
|
||||||
),
|
),
|
||||||
//body: ProgressView(),
|
//body: ProgressView(),
|
||||||
@ -160,7 +160,7 @@ class _SearchBarPageState extends State<SearchBarPage> {
|
|||||||
controller: controller,
|
controller: controller,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.only(top: 0.0),
|
contentPadding: EdgeInsets.only(top: 0.0),
|
||||||
hintText: '搜索全局flutter知识库',
|
hintText: '全网搜索 Flutter 相关知识库',
|
||||||
hintStyle:TextStyle(fontSize: 12.0),
|
hintStyle:TextStyle(fontSize: 12.0),
|
||||||
border: InputBorder.none
|
border: InputBorder.none
|
||||||
),
|
),
|
||||||
|
@ -30,7 +30,7 @@ dependencies:
|
|||||||
flutter_spinkit: "^3.1.0"
|
flutter_spinkit: "^3.1.0"
|
||||||
fluttertoast: ^3.1.0
|
fluttertoast: ^3.1.0
|
||||||
dio: ^2.0.15
|
dio: ^2.0.15
|
||||||
flutter_webview_plugin: ^0.3.4
|
flutter_webview_plugin: ^0.3.5
|
||||||
cookie_jar: ^1.0.0
|
cookie_jar: ^1.0.0
|
||||||
# 日期格式化
|
# 日期格式化
|
||||||
intl: 0.15.7
|
intl: 0.15.7
|
||||||
|
Reference in New Issue
Block a user