android short edge, dusty blue, info card layout

This commit is contained in:
niuhuan 2021-12-04 05:56:31 +08:00
parent 46494f13a5
commit c4b116087e
12 changed files with 101 additions and 65 deletions

View File

@ -3,10 +3,7 @@ package niuhuan.pikapika
import android.content.ContentValues import android.content.ContentValues
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.os.Build import android.os.*
import android.os.Environment
import android.os.Handler
import android.os.Looper
import android.provider.MediaStore import android.provider.MediaStore
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.Log import android.util.Log
@ -33,6 +30,10 @@ import java.util.concurrent.Executors
class MainActivity : FlutterActivity() { class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
}
// 为什么换成换成线程池而不继续使用携程 : 下载图片速度慢会占满携程造成拥堵, 接口无法请求 // 为什么换成换成线程池而不继续使用携程 : 下载图片速度慢会占满携程造成拥堵, 接口无法请求
private val pool = Executors.newCachedThreadPool { runnable -> private val pool = Executors.newCachedThreadPool { runnable ->
Thread(runnable).also { it.isDaemon = true } Thread(runnable).also { it.isDaemon = true }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when <!-- Show a splash screen on the activity. Automatically removed when
@ -14,5 +14,6 @@
This Theme is only used starting with V2 of Flutter's Android embedding. --> This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item> <item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:ignore="NewApi">shortEdges</item>
</style> </style>
</resources> </resources>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when <!-- Show a splash screen on the activity. Automatically removed when
@ -14,5 +14,6 @@
This Theme is only used starting with V2 of Flutter's Android embedding. --> This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item> <item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:ignore="NewApi">shortEdges</item>
</style> </style>
</resources> </resources>

View File

@ -12,11 +12,12 @@ enum FullScreenAction {
} }
Map<String, FullScreenAction> _fullScreenActionMap = { Map<String, FullScreenAction> _fullScreenActionMap = {
"使用控制器全屏": FullScreenAction.CONTROLLER,
"点击屏幕一次全屏": FullScreenAction.TOUCH_ONCE, "点击屏幕一次全屏": FullScreenAction.TOUCH_ONCE,
"使用控制器全屏": FullScreenAction.CONTROLLER,
"将屏幕划分成三个区域 (上一页, 下一页, 全屏)": FullScreenAction.THREE_AREA, "将屏幕划分成三个区域 (上一页, 下一页, 全屏)": FullScreenAction.THREE_AREA,
}; };
const _defaultController = FullScreenAction.TOUCH_ONCE;
const _propertyName = "fullScreenAction"; const _propertyName = "fullScreenAction";
late FullScreenAction _fullScreenAction; late FullScreenAction _fullScreenAction;
@ -37,7 +38,7 @@ FullScreenAction _fullScreenActionFromString(String string) {
return value; return value;
} }
} }
return FullScreenAction.CONTROLLER; return _defaultController;
} }
String currentFullScreenActionName() { String currentFullScreenActionName() {

View File

@ -6,7 +6,7 @@ import '../Method.dart';
const _ImageQualityOriginal = "original"; const _ImageQualityOriginal = "original";
const _ImageQualityLow = "low"; const _ImageQualityLow = "low";
const _ImageQualityMedium = "medium"; const _ImageQualityMedium = "medium";
const ImageQualityHigh = "high"; const _ImageQualityHigh = "high";
const _LabelOriginal = "原图"; const _LabelOriginal = "原图";
const _LabelLow = ""; const _LabelLow = "";
@ -17,7 +17,7 @@ var _qualities = {
_LabelOriginal: _ImageQualityOriginal, _LabelOriginal: _ImageQualityOriginal,
_LabelLow: _ImageQualityLow, _LabelLow: _ImageQualityLow,
_LabelMedium: _ImageQualityMedium, _LabelMedium: _ImageQualityMedium,
_LabelHigh: ImageQualityHigh, _LabelHigh: _ImageQualityHigh,
}; };
const _propertyName = "quality"; const _propertyName = "quality";

View File

@ -163,11 +163,48 @@ class _DarkTheme extends _ThemePackage {
); );
} }
//
class _DustyBlueTheme extends _ThemePackage {
@override
String code() => "dustyBlue";
@override
String name() => "灰蓝";
@override
ThemeData themeData(ThemeData rawData) =>
rawData.copyWith(
scaffoldBackgroundColor: Color.alphaBlend(Color(0x11999999), Color(0xff20253b)),
cardColor: Color.alphaBlend(Color(0x11AAAAAA), Color(0xff20253b)),
brightness: Brightness.light,
colorScheme: ColorScheme.light(
secondary: Colors.blue.shade200,
),
appBarTheme: AppBarTheme(
brightness: Brightness.dark,
color: Color(0xff20253b),
iconTheme: IconThemeData(
color: Colors.white,
),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Color(0xff191b26),
selectedItemColor: Colors.blue.shade200,
unselectedItemColor: Colors.grey.shade500,
),
dividerColor: Colors.grey.shade800,
);
}
var _darkTheme = _DarkTheme();
var _dustyBlueTheme = _DustyBlueTheme();
final _themePackages = <_ThemePackage>[ final _themePackages = <_ThemePackage>[
_OriginTheme(), _OriginTheme(),
_PinkTheme(), _PinkTheme(),
_BlackTheme(), _BlackTheme(),
_DarkTheme(), _darkTheme,
_dustyBlueTheme,
]; ];
// //
@ -210,11 +247,12 @@ void _changeThemeByCode(String? themeCode) {
} }
if (_themePackage != null) { if (_themePackage != null) {
_themeData = _themePackage.themeData( _themeData = _themePackage.themeData(
_fontThemeData(_themePackage == _themePackages[3]), _fontThemeData(
_themePackage == _darkTheme || _themePackage == _dustyBlueTheme),
); );
} }
_currentDarkTheme = _androidNightMode _currentDarkTheme = _androidNightMode
? _themePackages[3].themeData(_fontThemeData(true)) ? _darkTheme.themeData(_fontThemeData(true))
: _themeData; : _themeData;
themeEvent.broadcast(); themeEvent.broadcast();
} }

View File

@ -1,5 +0,0 @@
import 'package:flutter/material.dart';
var readerAppbarColor = Color(0xff1e202c);
var readerAppbarColor2 = readerAppbarColor.withAlpha(225);

View File

@ -36,6 +36,7 @@ class _PikapikaAppState extends State<PikapikaApp> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
debugShowCheckedModeBanner: false,
theme: currentThemeData(), theme: currentThemeData(),
darkTheme: currentDarkTheme(), darkTheme: currentDarkTheme(),
navigatorObservers: [navigatorObserver, routeObserver], navigatorObservers: [navigatorObserver, routeObserver],

View File

@ -8,9 +8,6 @@ import 'package:pikapika/basic/Method.dart';
import 'package:pikapika/basic/config/AutoFullScreen.dart'; import 'package:pikapika/basic/config/AutoFullScreen.dart';
import 'package:pikapika/basic/config/FullScreenUI.dart'; import 'package:pikapika/basic/config/FullScreenUI.dart';
import 'package:pikapika/basic/config/Quality.dart'; import 'package:pikapika/basic/config/Quality.dart';
import 'package:pikapika/basic/config/ReaderDirection.dart';
import 'package:pikapika/basic/config/ReaderType.dart';
import 'package:pikapika/basic/const.dart';
import 'package:pikapika/screens/components/ContentError.dart'; import 'package:pikapika/screens/components/ContentError.dart';
import 'package:pikapika/screens/components/ContentLoading.dart'; import 'package:pikapika/screens/components/ContentLoading.dart';
import 'components/ImageReader.dart'; import 'components/ImageReader.dart';
@ -146,7 +143,6 @@ class _ComicReaderScreenState extends State<ComicReaderScreen> {
appBar: _fullScreen appBar: _fullScreen
? null ? null
: AppBar( : AppBar(
backgroundColor: readerAppbarColor,
title: Text("${_ep.title} - ${widget.comicInfo.title}"), title: Text("${_ep.title} - ${widget.comicInfo.title}"),
), ),
body: ContentError( body: ContentError(
@ -165,7 +161,6 @@ class _ComicReaderScreenState extends State<ComicReaderScreen> {
appBar: _fullScreen appBar: _fullScreen
? null ? null
: AppBar( : AppBar(
backgroundColor: readerAppbarColor,
title: Text("${_ep.title} - ${widget.comicInfo.title}"), title: Text("${_ep.title} - ${widget.comicInfo.title}"),
), ),
body: ContentLoading(label: '加载中'), body: ContentLoading(label: '加载中'),

View File

@ -2,13 +2,11 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:pikapika/basic/Common.dart';
import 'package:pikapika/basic/Entities.dart'; import 'package:pikapika/basic/Entities.dart';
import 'package:pikapika/basic/config/AutoFullScreen.dart'; import 'package:pikapika/basic/config/AutoFullScreen.dart';
import 'package:pikapika/basic/config/FullScreenUI.dart'; import 'package:pikapika/basic/config/FullScreenUI.dart';
import 'package:pikapika/basic/config/ReaderDirection.dart'; import 'package:pikapika/basic/config/ReaderDirection.dart';
import 'package:pikapika/basic/config/ReaderType.dart'; import 'package:pikapika/basic/config/ReaderType.dart';
import 'package:pikapika/screens/components/ContentBuilder.dart';
import 'package:pikapika/basic/Method.dart'; import 'package:pikapika/basic/Method.dart';
import 'components/ContentError.dart'; import 'components/ContentError.dart';
import 'components/ContentLoading.dart'; import 'components/ContentLoading.dart';

View File

@ -151,7 +151,8 @@ class _ComicInfoCard extends State<ComicInfoCard> {
Text.rich(TextSpan(children: [ Text.rich(TextSpan(children: [
WidgetSpan(child: iconPage), WidgetSpan(child: iconPage),
WidgetSpan(child: iconSpacing), WidgetSpan(child: iconSpacing),
WidgetSpan(child: Text( WidgetSpan(
child: Text(
"${info.epsCount}E / ${info.pagesCount}P", "${info.epsCount}E / ${info.pagesCount}P",
style: countLabelStyle, style: countLabelStyle,
strutStyle: iconLabelStrutStyle, strutStyle: iconLabelStrutStyle,
@ -178,13 +179,15 @@ class _ComicInfoCard extends State<ComicInfoCard> {
...(like == null ...(like == null
? [] ? []
: [ : [
_likeLoading Container(height: 10),
Container(
height: 26,
child: _likeLoading
? IconButton( ? IconButton(
color: Colors.pink[400], color: Colors.pink[400],
onPressed: () {}, onPressed: () {},
icon: Icon( icon: Icon(
Icons.sync, Icons.sync,
size: 26,
), ),
) )
: IconButton( : IconButton(
@ -194,20 +197,22 @@ class _ComicInfoCard extends State<ComicInfoCard> {
like like
? Icons.favorite ? Icons.favorite
: Icons.favorite_border, : Icons.favorite_border,
size: 26, ),
), ),
), ),
]), ]),
...(favourite == null ...(favourite == null
? [] ? []
: [ : [
_favouriteLoading Container(height: 10),
Container(
height: 26,
child: _favouriteLoading
? IconButton( ? IconButton(
color: Colors.pink[400], color: Colors.pink[400],
onPressed: () {}, onPressed: () {},
icon: Icon( icon: Icon(
Icons.sync, Icons.sync,
size: 26,
), ),
) )
: IconButton( : IconButton(
@ -217,10 +222,11 @@ class _ComicInfoCard extends State<ComicInfoCard> {
favourite favourite
? Icons.bookmark ? Icons.bookmark
: Icons.bookmark_border, : Icons.bookmark_border,
size: 26, ),
), ),
), ),
]), ]),
Container(height: 10),
], ],
), ),
), ),

View File

@ -19,7 +19,6 @@ import 'package:pikapika/basic/config/Quality.dart';
import 'package:pikapika/basic/config/ReaderDirection.dart'; import 'package:pikapika/basic/config/ReaderDirection.dart';
import 'package:pikapika/basic/config/ReaderType.dart'; import 'package:pikapika/basic/config/ReaderType.dart';
import 'package:pikapika/basic/config/VolumeController.dart'; import 'package:pikapika/basic/config/VolumeController.dart';
import 'package:pikapika/basic/const.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../FilePhotoViewScreen.dart'; import '../FilePhotoViewScreen.dart';
import 'gesture_zoom_box.dart'; import 'gesture_zoom_box.dart';