forked from lxm_tools/flutter-picgo
feature:增加GithubRepo页面
This commit is contained in:
Binary file not shown.
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_picgo/views/home.dart';
|
||||
import 'package:flutter_picgo/views/album_page/album_page.dart';
|
||||
import 'package:flutter_picgo/views/pb_setting_page/github_page/github_repo_page.dart';
|
||||
import 'package:flutter_picgo/views/pb_setting_page/pb_setting_page.dart';
|
||||
import 'package:flutter_picgo/views/upload_page/upload_page.dart';
|
||||
import 'package:flutter_picgo/views/pb_setting_page/github_page/github_page.dart';
|
||||
@@ -22,30 +23,42 @@ var appHandler = new Handler(
|
||||
},
|
||||
);
|
||||
|
||||
// 404页面
|
||||
var notfoundHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => PageNotFound(),
|
||||
);
|
||||
|
||||
// 相册页面
|
||||
var albumHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => AlbumPage(),
|
||||
);
|
||||
|
||||
// 设置页面
|
||||
var settingHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => SettingPage(),
|
||||
);
|
||||
|
||||
// 上传页面
|
||||
var uploadHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => UploadPage(),
|
||||
);
|
||||
|
||||
// 图床设置页面
|
||||
var pbsettingHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => PBSettingPage(),
|
||||
);
|
||||
|
||||
// Github图床设置页面
|
||||
var pbsettingGithubHandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => GithubPage()
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => GithubPage(),
|
||||
);
|
||||
|
||||
// Github仓库列表页面
|
||||
var pbsettingGithubRepohandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => GithubRepoPage(),
|
||||
);
|
||||
|
||||
// picgo设置页面
|
||||
var picgosettinghandler = new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) => PicGoSettingPage(),
|
||||
);
|
||||
@@ -11,6 +11,7 @@ class Routes {
|
||||
static const String upload = '/upload';
|
||||
static const String settingPb = '/setting/pb';
|
||||
static const String settingPbGithub = '/setting/pb/github';
|
||||
static const String settingPbGitubRepo = '/setting/pb/github/repo';
|
||||
static const String settingPicgo = '/setting/picgo';
|
||||
|
||||
static void configureRoutes(Router router) {
|
||||
@@ -22,6 +23,7 @@ class Routes {
|
||||
router.define(setting, handler: settingHandler);
|
||||
router.define(settingPb, handler: pbsettingHandler);
|
||||
router.define(settingPbGithub, handler: pbsettingGithubHandler);
|
||||
router.define(settingPbGitubRepo, handler: pbsettingGithubRepohandler);
|
||||
router.define(settingPicgo, handler: picgosettinghandler);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_picgo/components/loading.dart';
|
||||
import 'package:flutter_picgo/model/github_config.dart';
|
||||
import 'package:flutter_picgo/resources/pb_type_keys.dart';
|
||||
import 'package:flutter_picgo/routers/application.dart';
|
||||
import 'package:flutter_picgo/routers/routers.dart';
|
||||
import 'package:flutter_picgo/utils/shared_preferences.dart';
|
||||
import 'package:flutter_picgo/views/pb_setting_page/github_page/github_page_presenter.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
@@ -13,11 +16,10 @@ class GithubPage extends StatefulWidget {
|
||||
|
||||
class _GithubPageState extends State<GithubPage> implements GithubPageContract {
|
||||
GithubConfig _config;
|
||||
bool _configSuccess = false;
|
||||
|
||||
GithubPagePresenter _presenter;
|
||||
|
||||
NetLoadingDialog _dialog;
|
||||
|
||||
TextEditingController _repositoryNameController,
|
||||
_branchNameController,
|
||||
_tokenController,
|
||||
@@ -51,12 +53,19 @@ class _GithubPageState extends State<GithubPage> implements GithubPageContract {
|
||||
appBar: AppBar(
|
||||
title: Text('Github图床'),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(IconData(0xe62a, fontFamily: 'iconfont')),
|
||||
onPressed: () {
|
||||
_testConfig();
|
||||
},
|
||||
),
|
||||
_configSuccess
|
||||
? IconButton( // 开启仓库
|
||||
icon: Icon(IconData(0xe6ab, fontFamily: 'iconfont')),
|
||||
onPressed: () {
|
||||
Application.router.navigateTo(context, Routes.settingPbGitubRepo, transition: TransitionType.cupertino);
|
||||
},
|
||||
)
|
||||
: IconButton( //连接测试
|
||||
icon: Icon(IconData(0xe62a, fontFamily: 'iconfont')),
|
||||
onPressed: () {
|
||||
_testConfig();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
@@ -225,6 +234,9 @@ class _GithubPageState extends State<GithubPage> implements GithubPageContract {
|
||||
|
||||
@override
|
||||
testConfigSuccess() {
|
||||
setState(() {
|
||||
this._configSuccess = true;
|
||||
});
|
||||
Toast.show("测试成功", context,
|
||||
duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
}
|
||||
|
||||
19
lib/views/pb_setting_page/github_page/github_repo_page.dart
Normal file
19
lib/views/pb_setting_page/github_page/github_repo_page.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GithubRepoPage extends StatefulWidget {
|
||||
|
||||
_GithubRepoPageState createState() => _GithubRepoPageState();
|
||||
|
||||
}
|
||||
|
||||
class _GithubRepoPageState extends State<GithubRepoPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('仓库内容'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user