update flutter to 3.27.0 & update packages

This commit is contained in:
2024-12-12 16:41:42 +08:00
parent c2cfd066f6
commit e4e2d264f5
31 changed files with 172 additions and 266 deletions

View File

@@ -262,7 +262,7 @@ class _CategoryPage extends StatelessWidget {
builder: (context) {
return Material(
borderRadius: const BorderRadius.all(Radius.circular(8)),
color: context.colorScheme.primaryContainer.withOpacity(0.72),
color: context.colorScheme.primaryContainer.toOpacity(0.72),
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(8)),
onTap: () => onClick(tag, param),

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:sliver_tools/sliver_tools.dart';
import 'package:venera/components/components.dart';
import 'package:venera/foundation/app.dart';
import 'package:venera/foundation/appdata.dart';

View File

@@ -92,7 +92,7 @@ class _FavoritesPageState extends State<FavoritesPage> {
barrierDismissible: true,
fullscreenDialog: true,
opaque: false,
barrierColor: Colors.black.withOpacity(0.36),
barrierColor: Colors.black.toOpacity(0.36),
pageBuilder: (context, animation, secondary) {
return Align(
alignment: Alignment.centerLeft,

View File

@@ -592,12 +592,16 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> {
late var comics = LocalFavoritesManager().getAllComics(widget.name);
bool changed = false;
Color lightenColor(Color color, double lightenValue) {
int red = (color.red + ((255 - color.red) * lightenValue)).round();
int green = (color.green + ((255 - color.green) * lightenValue)).round();
int blue = (color.blue + ((255 - color.blue) * lightenValue)).round();
static int _floatToInt8(double x) {
return (x * 255.0).round() & 0xff;
}
return Color.fromARGB(color.alpha, red, green, blue);
Color lightenColor(Color color, double lightenValue) {
int red = (_floatToInt8(color.r) + ((255 - color.r) * lightenValue)).round();
int green = (_floatToInt8(color.g) * 255 + ((255 - color.g) * lightenValue)).round();
int blue = (_floatToInt8(color.b) * 255 + ((255 - color.b) * lightenValue)).round();
return Color.fromARGB(_floatToInt8(color.a), red, green, blue);
}
@override
@@ -650,7 +654,7 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> {
),
],
),
body: ReorderableBuilder(
body: ReorderableBuilder<FavoriteItem>(
key: reorderWidgetKey,
scrollController: _scrollController,
longPressDelay: App.isDesktop
@@ -659,14 +663,14 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> {
onReorder: (reorderFunc) {
changed = true;
setState(() {
comics = reorderFunc(comics) as List<FavoriteItem>;
comics = reorderFunc(comics);
});
widget.onReorder(comics);
},
dragChildBoxDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: lightenColor(
Theme.of(context).splashColor.withOpacity(1),
Theme.of(context).splashColor.withAlpha(255),
0.2,
),
),

View File

@@ -179,7 +179,7 @@ class _LeftBarState extends State<_LeftBar> implements FolderList {
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: isSelected
? context.colorScheme.primaryContainer.withOpacity(0.36)
? context.colorScheme.primaryContainer.toOpacity(0.36)
: null,
border: Border(
left: BorderSide(
@@ -214,7 +214,7 @@ class _LeftBarState extends State<_LeftBar> implements FolderList {
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: isSelected
? context.colorScheme.primaryContainer.withOpacity(0.36)
? context.colorScheme.primaryContainer.toOpacity(0.36)
: null,
border: Border(
left: BorderSide(

View File

@@ -4,8 +4,6 @@ import 'package:venera/foundation/app.dart';
import 'package:venera/foundation/comic_source/comic_source.dart';
import 'package:venera/foundation/comic_type.dart';
import 'package:venera/foundation/history.dart';
import 'package:venera/foundation/local.dart';
import 'package:venera/utils/ext.dart';
import 'package:venera/utils/translations.dart';
class HistoryPage extends StatefulWidget {

View File

@@ -6,7 +6,6 @@ import 'package:venera/foundation/comic_source/comic_source.dart';
import 'package:venera/foundation/consts.dart';
import 'package:venera/foundation/favorites.dart';
import 'package:venera/foundation/history.dart';
import 'package:venera/foundation/image_provider/cached_image.dart';
import 'package:venera/foundation/image_provider/history_image_provider.dart';
import 'package:venera/foundation/image_provider/local_comic_image.dart';
import 'package:venera/foundation/local.dart';
@@ -17,7 +16,6 @@ import 'package:venera/pages/downloading_page.dart';
import 'package:venera/pages/history_page.dart';
import 'package:venera/pages/search_page.dart';
import 'package:venera/utils/data_sync.dart';
import 'package:venera/utils/ext.dart';
import 'package:venera/utils/import_comic.dart';
import 'package:venera/utils/translations.dart';
@@ -55,7 +53,7 @@ class _SearchBar extends StatelessWidget {
width: double.infinity,
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
child: Material(
color: context.colorScheme.surfaceContainer,
color: context.colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(32),
child: InkWell(
borderRadius: BorderRadius.circular(32),
@@ -580,7 +578,7 @@ class _ImportComicsWidgetState extends State<_ImportComicsWidget> {
onPressed: () {
showDialog(
context: context,
barrierColor: Colors.black.withOpacity(0.2),
barrierColor: Colors.black.toOpacity(0.2),
builder: (context) {
var help = '';
help +=

View File

@@ -268,5 +268,5 @@ class _DragListener {
void Function(Offset offset)? onMove;
void Function()? onEnd;
_DragListener({this.onStart, this.onMove, this.onEnd});
_DragListener({this.onMove, this.onEnd});
}

View File

@@ -1,4 +1,4 @@
library venera_reader;
library;
import 'dart:async';
import 'dart:math' as math;
@@ -62,7 +62,7 @@ class Reader extends StatefulWidget {
final String name;
/// Map<Chapter ID, Chapter Name>.
/// key: Chapter ID, value: Chapter Name
/// null if the comic is a gallery
final Map<String, String>? chapters;

View File

@@ -167,10 +167,10 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
child: Container(
padding: EdgeInsets.only(top: context.padding.top),
decoration: BoxDecoration(
color: context.colorScheme.surface.withOpacity(0.82),
color: context.colorScheme.surface.toOpacity(0.82),
border: Border(
bottom: BorderSide(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.toOpacity(0.5),
width: 0.5,
),
),
@@ -357,10 +357,10 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
return BlurEffect(
child: Container(
decoration: BoxDecoration(
color: context.colorScheme.surface.withOpacity(0.82),
color: context.colorScheme.surface.toOpacity(0.82),
border: Border(
top: BorderSide(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.toOpacity(0.5),
width: 0.5,
),
),
@@ -641,7 +641,7 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
color: Theme.of(context)
.colorScheme
.surfaceTint
.withOpacity(0.2),
.toOpacity(0.2),
child: const SizedBox.expand(),
),
),

View File

@@ -94,7 +94,7 @@ class _ExploreSettingsState extends State<ExploreSettings> {
}
class _ManageBlockingWordView extends StatefulWidget {
const _ManageBlockingWordView({super.key});
const _ManageBlockingWordView();
@override
State<_ManageBlockingWordView> createState() =>
@@ -135,7 +135,7 @@ class _ManageBlockingWordViewState extends State<_ManageBlockingWordView> {
void add() {
showDialog(
context: App.rootContext,
barrierColor: Colors.black.withOpacity(0.1),
barrierColor: Colors.black.toOpacity(0.1),
builder: (context) {
var controller = TextEditingController();
String? error;

View File

@@ -384,7 +384,7 @@ class _MultiPagesFilterState extends State<_MultiPagesFilter> {
Widget build(BuildContext context) {
var tiles = keys.map((e) => buildItem(e)).toList();
var view = ReorderableBuilder(
var view = ReorderableBuilder<String>(
key: reorderWidgetKey,
scrollController: scrollController,
longPressDelay: App.isDesktop
@@ -542,7 +542,7 @@ class _SettingPartTitle extends StatelessWidget {
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: context.colorScheme.onSurface.withOpacity(0.1),
color: context.colorScheme.onSurface.withValues(alpha: 0.1),
),
),
),

View File

@@ -267,7 +267,7 @@ class _SettingsPageState extends State<SettingsPage> implements PopEntry {
height: 46,
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
decoration: BoxDecoration(
color: selected ? colors.primaryContainer.withOpacity(0.36) : null,
color: selected ? colors.primaryContainer.toOpacity(0.36) : null,
border: Border(
left: BorderSide(
color: selected ? colors.primary : Colors.transparent,