Skip to content

Commit

Permalink
feat(setting): add setting page and adjust some codes and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Aoi-hosizora committed Jan 3, 2021
1 parent 75ed87e commit e706e77
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 14 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# manhuagui_flutter

+ An unofficial application for manhuagui (https://www.manhuagui.com/) written in flutter
+ Backend see [Aoi-hosizora/manhuagui-backend](https://github.com/Aoi-hosizora/manhuagui-backend)
+ An unofficial application for manhuagui (https://www.manhuagui.com/) written in flutter.
+ Backend see [Aoi-hosizora/manhuagui-backend](https://github.com/Aoi-hosizora/manhuagui-backend) (private).

### Dependencies

+ See [pubspec.yaml](./pubspec.yaml).
+ You may be unable to build the project successfully, because [flutter_ahlib](https://github.com/Aoi-hosizora/flutter_ahlib) is a local library yet.
Please wait for the release of `flutter_ahlib v1.2` and refactoring.

### Install

+ See [Release](https://github.com/Aoi-hosizora/manhuagui_flutter/releases).

### Screenshots

|![screenshot1](./assets/screenshot1.png)|![screenshot2](./assets/screenshot2.png)|![screenshot3](./assets/screenshot3.png)|
|---|---|---|
|![screenshot4](./assets/screenshot4.png)|![screenshot5](./assets/screenshot5.png)|![screenshot6](./assets/screenshot6.png)|
Binary file modified assets/actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed lib/assets/.gitkeep
Empty file.
Binary file added lib/assets/ic_launcher_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions lib/config.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
const DEBUG = true;
const APP_NAME = 'manhuagui';
const APP_NAME = 'Manhuagui';
const APP_VERSION = '1.0.2';
const APP_DESCRIPTIONS = [
'非官方的漫画柜 (manhuagui) 安卓客户端,Flutter 开发',
'作者: Github Aoi-hosizora <[email protected]>',
'',
'该客户端仅供学习研究使用,请勿用于商业用途。',
'本应用与内容提供方无任何联系,若有任何问题,请发邮件或 Issue 联系。',
];
const DB_NAME = 'db_manhuagui';

const WEB_HOMEPAGE_URL = 'https://www.manhuagui.com/';
const APP_HOMEPAGE_URL = 'https://github.com/Aoi-hosizora/manhuagui_flutter';
const CONTACT = '';
const FEEDBACK_URL = 'https://github.com/Aoi-hosizora/manhuagui_flutter/issues/new';
const RELEASE_URL = 'https://github.com/Aoi-hosizora/manhuagui_flutter/releases';

const CONNECT_TIMEOUT = 10000; // 10s
const SEND_TIMEOUT = 5000; // 5s
const RECEIVE_TIMEOUT = 5000; // 5s

// const BASE_API_URL = 'http://10.0.3.2:10018/v1/';
const BASE_API_URL = 'http://api.manhuagui.aoihosizora.top/v1/';
const BASE_WEB_URL = 'https://www.manhuagui.com/';
const REGISTER_URL = 'https://www.manhuagui.com/user/register';

const USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36';
Expand Down
1 change: 1 addition & 0 deletions lib/page/manga_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class _MangaDetailPageState extends State<MangaDetailPage> {
_details = [
Tuple2('mid', widget.data.mid.toString()),
Tuple2('标题', widget.data.title),
Tuple2('标题别名', widget.data.aliasTitle ?? '暂无'),
Tuple2('别名', widget.data.alias),
Tuple2('封面链接', widget.data.cover),
Tuple2('网页链接', widget.data.url),
Expand Down
2 changes: 1 addition & 1 deletion lib/page/page/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class _HomeSubPageState extends State<HomeSubPage> with SingleTickerProviderStat
tooltip: '浏览器打开',
onPressed: () => launchInBrowser(
context: context,
url: BASE_WEB_URL,
url: WEB_HOMEPAGE_URL,
),
),
IconButton(
Expand Down
13 changes: 8 additions & 5 deletions lib/page/page/mine.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_ahlib/flutter_ahlib.dart';
import 'package:manhuagui_flutter/config.dart';
import 'package:manhuagui_flutter/model/user.dart';
import 'package:manhuagui_flutter/page/setting.dart';
import 'package:manhuagui_flutter/page/view/login_first.dart';
import 'package:manhuagui_flutter/page/view/network_image.dart';
import 'package:manhuagui_flutter/service/natives/browser.dart';
import 'package:manhuagui_flutter/service/prefs/auth.dart';
import 'package:manhuagui_flutter/service/retrofit/dio_manager.dart';
import 'package:manhuagui_flutter/service/retrofit/retrofit.dart';
Expand Down Expand Up @@ -179,10 +178,14 @@ class _MineSubPageState extends State<MineSubPage> with AutomaticKeepAliveClient
child: Material(
color: Colors.transparent,
child: IconButton(
icon: Icon(Icons.feedback, color: Colors.black54),
tooltip: '反馈',
icon: Icon(Icons.settings, color: Colors.black54),
tooltip: '设置',
padding: EdgeInsets.all(25),
onPressed: () => launchInBrowser(context: context, url: FEEDBACK_URL),
onPressed: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (c) => SettingPage(),
),
),
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/page/page/recommend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class _RecommendSubPageState extends State<RecommendSubPage> with AutomaticKeepA
return InkWell(
onTap: () => action(),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 6),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: IconText(
alignment: IconTextAlignment.t2b,
space: 8,
Expand Down Expand Up @@ -117,7 +117,7 @@ class _RecommendSubPageState extends State<RecommendSubPage> with AutomaticKeepA
child: Material(
color: Colors.transparent,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 35, vertical: 8),
padding: EdgeInsets.symmetric(horizontal: 35, vertical: 4),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand Down
124 changes: 124 additions & 0 deletions lib/page/setting.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import 'package:flutter/material.dart';
import 'package:manhuagui_flutter/config.dart';
import 'package:manhuagui_flutter/service/natives/browser.dart';

/// 设置页
class SettingPage extends StatefulWidget {
@override
_SettingPageState createState() => _SettingPageState();
}

class _SettingPageState extends State<SettingPage> {
Widget _item({@required String title, Function action}) {
return Container(
color: Colors.white,
child: Material(
color: Colors.transparent,
child: InkWell(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 12),
child: Text(
title,
style: Theme.of(context).textTheme.subtitle1,
),
),
onTap: action ?? () {},
),
),
);
}

Widget _divider() {
return Container(
color: Colors.white,
padding: EdgeInsets.only(left: 10, right: 10),
child: Divider(height: 1, thickness: 1),
);
}

Widget _spacer() {
return SizedBox(height: 15);
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
toolbarHeight: 45,
title: Text('设置'),
),
body: ListView(
children: [
_spacer(),
// *******************************************************
_item(
title: '漫画官网',
action: () => launchInBrowser(
context: context,
url: WEB_HOMEPAGE_URL,
),
),
_divider(),
_item(
title: '客户端源码',
action: () => launchInBrowser(
context: context,
url: APP_HOMEPAGE_URL,
),
),
_spacer(),
// *******************************************************
_item(
title: '反馈及联系作者',
action: () => launchInBrowser(
context: context,
url: FEEDBACK_URL,
),
),
_divider(),
_item(
title: '检查更新',
action: () => launchInBrowser(
context: context,
url: RELEASE_URL,
),
),
_divider(),
_item(
title: '关于',
action: () => showAboutDialog(
context: context,
useRootNavigator: false,
applicationName: APP_NAME,
applicationVersion: APP_VERSION,
applicationIcon: SizedBox(
height: 50,
width: 50,
child: Image.asset('lib/assets/ic_launcher_h.png'),
),
applicationLegalese: '© 2020-2021 Aoi-hosizora',
children: [
SizedBox(height: 20),
for (var r in APP_DESCRIPTIONS)
Text(
r,
style: Theme.of(context).textTheme.subtitle1,
),
],
),
),
_spacer(),
// *******************************************************
Align(
alignment: Alignment.center,
child: Text(
'© 2020-2021 Aoi-hosizora',
style: TextStyle(color: Colors.grey),
),
),
],
),
);
}
}
7 changes: 5 additions & 2 deletions lib/page/view/comment_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,17 @@ class _CommentLineViewState extends State<CommentLineView> {
children: [
Text(
"${line.username == '-' ? '匿名用户' : line.username}: ",
style: Theme.of(context).textTheme.bodyText1.copyWith(color: Theme.of(context).primaryColor),
style: TextStyle(
fontSize: Theme.of(context).textTheme.bodyText1.fontSize,
color: Theme.of(context).primaryColor,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Expanded(
child: Text(
line.content,
style: Theme.of(context).textTheme.bodyText1,
style: TextStyle(fontSize: Theme.of(context).textTheme.bodyText1.fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Expand Down

0 comments on commit e706e77

Please sign in to comment.