Skip to content

Commit

Permalink
[Release 3.1]增加收藏和GitHub API
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyisheng committed Aug 8, 2020
1 parent b4df527 commit c6ea437
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.11/","dependencies":[]},{"name":"share","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4+3/","dependencies":[]},{"name":"shared_preferences","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.5.0/","dependencies":[]},{"name":"webview_flutter","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.22+1/","dependencies":[]}],"android":[{"name":"path_provider","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.11/","dependencies":[]},{"name":"share","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4+3/","dependencies":[]},{"name":"shared_preferences","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.5.0/","dependencies":[]},{"name":"webview_flutter","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.22+1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/ityw/Downloads/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"webview_flutter","dependencies":[]}],"date_created":"2020-08-07 20:04:51.897760","version":"1.20.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.11/","dependencies":[]},{"name":"share","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4+3/","dependencies":[]},{"name":"shared_preferences","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.5.0/","dependencies":[]},{"name":"webview_flutter","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.22+1/","dependencies":[]}],"android":[{"name":"path_provider","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.11/","dependencies":[]},{"name":"share","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.4+3/","dependencies":[]},{"name":"shared_preferences","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.5.0/","dependencies":[]},{"name":"webview_flutter","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.22+1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/xuyisheng/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"webview_flutter","dependencies":[]}],"date_created":"2020-08-08 16:51:01.509294","version":"1.20.1"}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ class _NavigationRailWidgetState extends State<NavigationRailWidget> {
NavigationRail(
selectedIndex: _selectedIndex,
onDestinationSelected: (int index) {
setState(() {
_selectedIndex = index;
});
setState(() => _selectedIndex = index);
},
leading: IconButton(
icon: Icon(Icons.tune),
color: Colors.red.shade200,
onPressed: () {},
),
labelType: NavigationRailLabelType.selected,
destinations: [
NavigationRailDestination(
Expand Down
28 changes: 22 additions & 6 deletions lib/pages/feed/feedmainpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class FeedMainPage extends StatelessWidget {
}
var detail = feedList[index];
return GestureDetector(
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => FeedDetailPage(article: detail))),
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => FeedDetailPage(article: detail))),
child: Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
Expand Down Expand Up @@ -86,9 +87,14 @@ class FeedMainPage extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: <Widget>[
CircleAvatar(
radius: 12,
backgroundImage: NetworkImage('${detail.owner.avatarUrl}'),
Icon(Icons.star, color: Colors.redAccent.withAlpha(125)),
SizedBox(width: 4),
Text(
'${detail.stargazersCount}',
style: TextStyle(
fontSize: 14,
color: Colors.grey.shade700,
),
),
SizedBox(width: 24),
Text(
Expand All @@ -100,7 +106,17 @@ class FeedMainPage extends StatelessWidget {
),
SizedBox(width: 24),
Text(
'${formatDate(DateTime.parse(detail.createdAt), [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn])}',
'${formatDate(DateTime.parse(detail.createdAt), [
yyyy,
'-',
mm,
'-',
dd,
' ',
HH,
':',
nn
])}',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade500,
Expand Down Expand Up @@ -129,7 +145,7 @@ class FeedListViewModel with ChangeNotifier {
int pageIndex = 0;

void getFlutterFeedList() async {
var feedEntity = await client.getTagDataList('android+in:description,name', 'updated', 'desc', pageIndex, 10);
var feedEntity = await client.getTagDataList('flutter+in:description,name', 'updated', 'desc', pageIndex, 10);
var list = feedEntity.items;
if (list.length > 0) {
pageIndex++;
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/feed/restclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:retrofit/retrofit.dart';

part 'restclient.g.dart';

/// Step 1: flutter pub upgrade
/// Step 2: flutter pub run build_runner build
@RestApi(baseUrl: 'https://api.github.com/search/')
abstract class RestClient {
factory RestClient(Dio dio, {String baseUrl}) = _RestClient;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A new Flutter application.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.0.0+2
version: 3.1.0+3

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit c6ea437

Please sign in to comment.