mod: flutter 3.16 特性迁移
This commit is contained in:
@ -69,7 +69,7 @@ class VideoCardH extends StatelessWidget {
|
|||||||
final double width = (boxConstraints.maxWidth -
|
final double width = (boxConstraints.maxWidth -
|
||||||
StyleString.cardSpace *
|
StyleString.cardSpace *
|
||||||
6 /
|
6 /
|
||||||
MediaQuery.of(context).textScaleFactor) /
|
MediaQuery.textScalerOf(context).scale(1.0)) /
|
||||||
2;
|
2;
|
||||||
return Container(
|
return Container(
|
||||||
constraints: const BoxConstraints(minHeight: 88),
|
constraints: const BoxConstraints(minHeight: 88),
|
||||||
|
|||||||
@ -326,7 +326,8 @@ class VideoStat extends StatelessWidget {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
fontSize: MediaQuery.textScalerOf(context)
|
||||||
|
.scale(Theme.of(context).textTheme.labelSmall!.fontSize!),
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -156,9 +156,8 @@ class MyApp extends StatelessWidget {
|
|||||||
return FlutterSmartDialog(
|
return FlutterSmartDialog(
|
||||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
data: MediaQuery.of(context).copyWith(
|
data: MediaQuery.of(context)
|
||||||
textScaleFactor:
|
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||||
MediaQuery.of(context).textScaleFactor * textScale),
|
|
||||||
child: child!,
|
child: child!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -224,7 +224,7 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
// 列数
|
// 列数
|
||||||
crossAxisCount: 3,
|
crossAxisCount: 3,
|
||||||
mainAxisExtent: Get.size.width / 3 / 0.65 +
|
mainAxisExtent: Get.size.width / 3 / 0.65 +
|
||||||
32 * MediaQuery.of(context).textScaleFactor,
|
MediaQuery.textScalerOf(context).scale(32.0),
|
||||||
),
|
),
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
|
|||||||
@ -162,8 +162,9 @@ class _LivePageState extends State<LivePage>
|
|||||||
crossAxisCount: crossAxisCount,
|
crossAxisCount: crossAxisCount,
|
||||||
mainAxisExtent:
|
mainAxisExtent:
|
||||||
Get.size.width / crossAxisCount / StyleString.aspectRatio +
|
Get.size.width / crossAxisCount / StyleString.aspectRatio +
|
||||||
(crossAxisCount == 1 ? 48 : 68) *
|
MediaQuery.textScalerOf(context).scale(
|
||||||
MediaQuery.of(context).textScaleFactor,
|
(crossAxisCount == 1 ? 48 : 68),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
|
|||||||
@ -163,7 +163,7 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
// const SizedBox(height: 10),
|
// const SizedBox(height: 10),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 200 * MediaQuery.of(context).textScaleFactor,
|
height: MediaQuery.textScalerOf(context).scale(200),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
|||||||
@ -28,8 +28,7 @@ Widget searchArticlePanel(BuildContext context, ctr, list) {
|
|||||||
double width = (boxConstraints.maxWidth -
|
double width = (boxConstraints.maxWidth -
|
||||||
StyleString.cardSpace *
|
StyleString.cardSpace *
|
||||||
6 /
|
6 /
|
||||||
MediaQuery.of(context).textScaleFactor) /
|
MediaQuery.textScalerOf(context).scale(2.0));
|
||||||
2;
|
|
||||||
return Container(
|
return Container(
|
||||||
constraints: const BoxConstraints(minHeight: 88),
|
constraints: const BoxConstraints(minHeight: 88),
|
||||||
height: width / StyleString.aspectRatio,
|
height: width / StyleString.aspectRatio,
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Widget searchLivePanel(BuildContext context, ctr, list) {
|
|||||||
mainAxisSpacing: StyleString.cardSpace + 3,
|
mainAxisSpacing: StyleString.cardSpace + 3,
|
||||||
mainAxisExtent:
|
mainAxisExtent:
|
||||||
MediaQuery.sizeOf(context).width / 2 / StyleString.aspectRatio +
|
MediaQuery.sizeOf(context).width / 2 / StyleString.aspectRatio +
|
||||||
66 * MediaQuery.of(context).textScaleFactor),
|
MediaQuery.textScalerOf(context).scale(66.0)),
|
||||||
itemCount: list.length,
|
itemCount: list.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return LiveItem(liveItem: list![index]);
|
return LiveItem(liveItem: list![index]);
|
||||||
|
|||||||
@ -67,11 +67,11 @@ Widget searchMbangumiPanel(BuildContext context, ctr, list) {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
text: i['text'],
|
text: i['text'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: Theme.of(context)
|
fontSize: MediaQuery.textScalerOf(context)
|
||||||
|
.scale(Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.titleSmall!
|
.titleSmall!
|
||||||
.fontSize! *
|
.fontSize!),
|
||||||
MediaQuery.of(context).textScaleFactor,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: i['type'] == 'em'
|
color: i['type'] == 'em'
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
|
|||||||
@ -786,7 +786,7 @@ class PlPlayerController {
|
|||||||
volume.value = volumeNew;
|
volume.value = volumeNew;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FlutterVolumeController.showSystemUI = false;
|
FlutterVolumeController.updateShowSystemUI(false);
|
||||||
await FlutterVolumeController.setVolume(volumeNew);
|
await FlutterVolumeController.setVolume(volumeNew);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print(err);
|
print(err);
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -130,7 +129,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: false);
|
setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: false);
|
||||||
Future.microtask(() async {
|
Future.microtask(() async {
|
||||||
try {
|
try {
|
||||||
FlutterVolumeController.showSystemUI = true;
|
FlutterVolumeController.updateShowSystemUI(true);
|
||||||
_ctr.volumeValue.value = (await FlutterVolumeController.getVolume())!;
|
_ctr.volumeValue.value = (await FlutterVolumeController.getVolume())!;
|
||||||
FlutterVolumeController.addListener((double value) {
|
FlutterVolumeController.addListener((double value) {
|
||||||
if (mounted && !_ctr.volumeInterceptEventStream.value) {
|
if (mounted && !_ctr.volumeInterceptEventStream.value) {
|
||||||
@ -154,7 +153,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
Future<void> setVolume(double value) async {
|
Future<void> setVolume(double value) async {
|
||||||
try {
|
try {
|
||||||
FlutterVolumeController.showSystemUI = false;
|
FlutterVolumeController.updateShowSystemUI(false);
|
||||||
await FlutterVolumeController.setVolume(value);
|
await FlutterVolumeController.setVolume(value);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
_ctr.volumeValue.value = value;
|
_ctr.volumeValue.value = value;
|
||||||
|
|||||||
Reference in New Issue
Block a user