Skip to content

Commit 1ef6a22

Browse files
committed
新增作者信息详情页面
1 parent 10bd33a commit 1ef6a22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1786
-142
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Reactive Native版:[ReactNative_Eyepetizer](https://github.com/fmtjava/ReactNa
6060
<img src="https://www.pgyer.com/app/qrcode/nVnf"/>
6161
- ios请自行clone项目代码运行
6262
# 更新日志
63+
### v2.0.1
64+
* 新增作者项目模块
6365
### v2.0.0
6466
* 组件化重构项目
6567
### v1.1.6

component/lib_core/lib/lib_core.dart

-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
library lib_core;
2-
3-
/// A Calculator.
4-
class Calculator {
5-
/// Returns [value] plus 1.
6-
int addOne(int value) => value + 1;
7-
}

component/lib_core/lib/state/base_list_state.dart

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ abstract class BaseListState<L, M extends PagingListModel<L, PagingModel<L>>,
1313

1414
Widget getContentChild(M model); //真实的分页控件
1515

16+
bool get enablePullDown => true;
17+
1618
@override
1719
Widget build(BuildContext context) {
1820
super.build(context);
@@ -32,6 +34,7 @@ abstract class BaseListState<L, M extends PagingListModel<L, PagingModel<L>>,
3234
onRefresh: model.refresh,
3335
onLoading: model.loadMore,
3436
enablePullUp: true,
37+
enablePullDown: enablePullDown,
3538
child: getContentChild(model))));
3639
});
3740
}
+1-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import 'package:flutter_test/flutter_test.dart';
21

3-
import 'package:lib_core/lib_core.dart';
42

53
void main() {
6-
test('adds one to input values', () {
7-
final calculator = Calculator();
8-
expect(calculator.addOne(2), 3);
9-
expect(calculator.addOne(-7), -6);
10-
expect(calculator.addOne(0), 1);
11-
});
4+
125
}

component/lib_navigator/lib/lib_navigator.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@ library lib_navigator;
22

33
import 'package:flutter/material.dart';
44
import 'package:get/get.dart';
5-
65
export 'package:get/get.dart';
76

7+
//页面路由常用方法封装
8+
89
void toPage(Widget page, {bool opaque = false}) {
910
Get.to(() => page, opaque: opaque);
1011
}
1112

12-
void toNamed(String page, dynamic arguments) {
13-
Get.toNamed(page, arguments: arguments);
13+
void toNamed(String page, dynamic arguments, {preventDuplicates: false}) {
14+
Get.toNamed(page, preventDuplicates: preventDuplicates, arguments: arguments);
1415
}
1516

1617
void back() {
1718
Get.back();
1819
}
1920

21+
//获取页面传递的参数
2022
dynamic arguments() {
2123
return Get.arguments;
2224
}

ios/Flutter/Flutter.podspec

-18
This file was deleted.

ios/Flutter/flutter_export_environment.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
# This is a generated file; do not edit or check into version control.
33
export "FLUTTER_ROOT=/Users/taofang/flutter"
44
export "FLUTTER_APPLICATION_PATH=/Users/taofang/FlutterProject/Flutter_Eyepetizer"
5-
export "FLUTTER_TARGET=/Users/taofang/FlutterProject/Flutter_Eyepetizer/lib/main.dart"
5+
export "FLUTTER_TARGET=lib/main.dart"
66
export "FLUTTER_BUILD_DIR=build"
77
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
88
export "FLUTTER_BUILD_NAME=2.0.0"
99
export "FLUTTER_BUILD_NUMBER=1"
10-
export "DART_DEFINES=flutter.inspector.structuredErrors%3Dtrue"
1110
export "DART_OBFUSCATION=false"
12-
export "TRACK_WIDGET_CREATION=true"
11+
export "TRACK_WIDGET_CREATION=false"
1312
export "TREE_SHAKE_ICONS=false"
14-
export "PACKAGE_CONFIG=/Users/taofang/FlutterProject/Flutter_Eyepetizer/.dart_tool/package_config.json"
13+
export "PACKAGE_CONFIG=.packages"

lib/main.dart

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:flutter_eyepetizer/navigation/tab_navigation.dart';
55
import 'package:flutter_eyepetizer/app_initialize.dart';
66
import 'package:lib_navigator/lib_navigator.dart';
77
import 'package:module_detail/page/video_detail_page.dart';
8+
import 'package:module_author/page/author_page.dart';
89

910
void main() {
1011
runApp(App());
@@ -54,6 +55,7 @@ class _GetMaterialAppWidgetState extends State<GetMaterialAppWidget> {
5455
getPages: [
5556
GetPage(name: '/', page: () => widget.child),
5657
GetPage(name: '/detail', page: () => VideoDetailPage()),
58+
GetPage(name: '/author', page: () => AuthorPage()),
5759
],
5860
);
5961
}

module/module_author/.gitignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.DS_Store
2+
.dart_tool/
3+
4+
.packages
5+
.pub/
6+
7+
.idea/
8+
.vagrant/
9+
.sconsign.dblite
10+
.svn/
11+
12+
*.swp
13+
profile
14+
15+
DerivedData/
16+
17+
.generated/
18+
19+
*.pbxuser
20+
*.mode1v3
21+
*.mode2v3
22+
*.perspectivev3
23+
24+
!default.pbxuser
25+
!default.mode1v3
26+
!default.mode2v3
27+
!default.perspectivev3
28+
29+
xcuserdata
30+
31+
*.moved-aside
32+
33+
*.pyc
34+
*sync/
35+
Icon?
36+
.tags*
37+
38+
build/
39+
.android/
40+
.ios/
41+
.flutter-plugins
42+
.flutter-plugins-dependencies
43+
44+
# Symbolication related
45+
app.*.symbols
46+
47+
# Obfuscation related
48+
app.*.map.json

module/module_author/.metadata

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
8+
channel: stable
9+
10+
project_type: module

module/module_author/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## [0.0.1] - TODO: Add release date.
2+
3+
* TODO: Describe initial release.

module/module_author/LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.

module/module_author/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# module_author
2+
3+
作者信息模块
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Dart
8+
[package](https://flutter.dev/developing-packages/),
9+
a library module containing code that can be shared easily across
10+
multiple Flutter or Dart projects.
11+
12+
For help getting started with Flutter, view our
13+
[online documentation](https://flutter.dev/docs), which offers tutorials,
14+
samples, guidance on mobile development, and a full API reference.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import 'package:module_common/constant/http_constant.dart';
2+
3+
class URLs {
4+
static String tabUrl = '${HttpConstant.baseUrl}v4/pgcs/detail/tab?id=';
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const String author_works = '作品';
2+
const String author_flows = '关注';
3+
const String author_share = '分享';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:flutter/material.dart';
2+
//自定义SliverPersistentHeaderDelegate保证child滑动顶部时吸顶
3+
class StickyTabBarDelegate extends SliverPersistentHeaderDelegate {
4+
final TabBar child;
5+
6+
StickyTabBarDelegate({@required this.child});
7+
8+
@override
9+
Widget build(
10+
BuildContext context, double shrinkOffset, bool overlapsContent) {
11+
return Container(
12+
color: Colors.white,
13+
child: this.child,
14+
);
15+
}
16+
17+
//吸顶的关键:maxExtent = minExtent = child.preferredSize.height
18+
@override
19+
double get maxExtent => this.child.preferredSize.height;
20+
21+
@override
22+
double get minExtent => this.child.preferredSize.height;
23+
24+
@override
25+
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
26+
return true;
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
library module_author;
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:module_author/widget/all_widget_item.dart';
3+
import 'package:lib_core/state/base_list_state.dart';
4+
import 'package:module_author/viewmodel/author_tab_page_model.dart';
5+
import 'package:module_common/model/common_item_model.dart';
6+
7+
class AllTabPage extends StatefulWidget {
8+
final apiUrl;
9+
10+
const AllTabPage({Key key, this.apiUrl}) : super(key: key);
11+
12+
@override
13+
_AllTabPageState createState() => _AllTabPageState();
14+
}
15+
16+
class _AllTabPageState
17+
extends BaseListState<Item, AuthorTabPageModel, AllTabPage> {
18+
@override
19+
Widget getContentChild(AuthorTabPageModel model) => ListView.separated(
20+
itemBuilder: (context, index) {
21+
return AllWidgetItem(
22+
item: model.itemList[index],
23+
);
24+
},
25+
separatorBuilder: (context, index) {
26+
return Padding(
27+
padding: EdgeInsets.symmetric(horizontal: 15),
28+
child: Divider(
29+
height: 0.5,
30+
),
31+
);
32+
},
33+
itemCount: model.itemList.length);
34+
35+
@override
36+
AuthorTabPageModel get viewModel => AuthorTabPageModel(widget.apiUrl);
37+
38+
@override
39+
bool get enablePullDown => false;
40+
}

0 commit comments

Comments
 (0)