Commit 5bc84efff2a8b34553ae4b6d8d27b7419970d017

Authored by 吴启风
1 parent 3154647c

Revert "feat: 优化视频专区列表布局与沉浸体验"

This reverts commit 9475aa49.
lib/pages/video/zone/video_zone_page.dart
1 -import 'dart:async';  
2 -  
3 import 'package:cached_network_image/cached_network_image.dart'; 1 import 'package:cached_network_image/cached_network_image.dart';
4 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
5 -import 'package:flutter/services.dart';  
6 import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 import 'package:wow_english/common/dialogs/show_dialog.dart'; 4 import 'package:wow_english/common/dialogs/show_dialog.dart';
8 import 'package:wow_english/common/request/dao/video_dao.dart'; 5 import 'package:wow_english/common/request/dao/video_dao.dart';
@@ -24,20 +21,9 @@ class _VideoZonePageState extends State<VideoZonePage> { @@ -24,20 +21,9 @@ class _VideoZonePageState extends State<VideoZonePage> {
24 @override 21 @override
25 void initState() { 22 void initState() {
26 super.initState(); 23 super.initState();
27 - unawaited(  
28 - SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),  
29 - );  
30 _itemsFuture = VideoDao.list(); 24 _itemsFuture = VideoDao.list();
31 } 25 }
32 26
33 - @override  
34 - void dispose() {  
35 - unawaited(  
36 - SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),  
37 - );  
38 - super.dispose();  
39 - }  
40 -  
41 void _reload() { 27 void _reload() {
42 setState(() { 28 setState(() {
43 _itemsFuture = VideoDao.list(); 29 _itemsFuture = VideoDao.list();
@@ -46,10 +32,7 @@ class _VideoZonePageState extends State<VideoZonePage> { @@ -46,10 +32,7 @@ class _VideoZonePageState extends State<VideoZonePage> {
46 32
47 @override 33 @override
48 Widget build(BuildContext context) { 34 Widget build(BuildContext context) {
49 - return MediaQuery.removePadding(  
50 - context: context,  
51 - removeTop: true,  
52 - child: Scaffold( 35 + return Scaffold(
53 backgroundColor: Colors.white, 36 backgroundColor: Colors.white,
54 appBar: const WEAppBar( 37 appBar: const WEAppBar(
55 titleText: '视频专区', 38 titleText: '视频专区',
@@ -81,34 +64,20 @@ class _VideoZonePageState extends State<VideoZonePage> { @@ -81,34 +64,20 @@ class _VideoZonePageState extends State<VideoZonePage> {
81 }, 64 },
82 child: LayoutBuilder( 65 child: LayoutBuilder(
83 builder: (context, constraints) { 66 builder: (context, constraints) {
84 - final horizontalPadding = 30.w;  
85 - final crossAxisSpacing = 12.w;  
86 final titleStyle = _VideoCard.createTitleStyle(context); 67 final titleStyle = _VideoCard.createTitleStyle(context);
87 - final titlePainter = TextPainter(  
88 - text: TextSpan(text: '视频标题', style: titleStyle),  
89 - maxLines: 1,  
90 - textDirection: Directionality.of(context),  
91 - textScaler: MediaQuery.textScalerOf(context),  
92 - )..layout();  
93 - final cardWidth = (constraints.maxWidth -  
94 - horizontalPadding * 2 -  
95 - crossAxisSpacing * 2) /  
96 - 3;  
97 - final cardHeight =  
98 - cardWidth * 9 / 16 + 5.h + titlePainter.height;  
99 return GridView.builder( 68 return GridView.builder(
100 physics: const AlwaysScrollableScrollPhysics(), 69 physics: const AlwaysScrollableScrollPhysics(),
101 padding: EdgeInsets.fromLTRB( 70 padding: EdgeInsets.fromLTRB(
102 - horizontalPadding, 71 + 14.w,
103 10.h, 72 10.h,
104 - horizontalPadding, 73 + 14.w,
105 16.h, 74 16.h,
106 ), 75 ),
107 gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 76 gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
108 - crossAxisCount: 3, 77 + crossAxisCount: 4,
109 mainAxisSpacing: 14.h, 78 mainAxisSpacing: 14.h,
110 - crossAxisSpacing: crossAxisSpacing,  
111 - mainAxisExtent: cardHeight, 79 + crossAxisSpacing: 12.w,
  80 + childAspectRatio: 1.55,
112 ), 81 ),
113 itemCount: items.length, 82 itemCount: items.length,
114 itemBuilder: (context, index) => _VideoCard( 83 itemBuilder: (context, index) => _VideoCard(
@@ -122,8 +91,7 @@ class _VideoZonePageState extends State<VideoZonePage> { @@ -122,8 +91,7 @@ class _VideoZonePageState extends State<VideoZonePage> {
122 ); 91 );
123 }, 92 },
124 ), 93 ),
125 - ),  
126 - ); 94 + );
127 } 95 }
128 96
129 void _openVideo(List<VideoZoneItem> items, int index) { 97 void _openVideo(List<VideoZoneItem> items, int index) {
@@ -144,13 +112,7 @@ class _VideoZonePageState extends State&lt;VideoZonePage&gt; { @@ -144,13 +112,7 @@ class _VideoZonePageState extends State&lt;VideoZonePage&gt; {
144 .toList(), 112 .toList(),
145 'initialVideoId': item.id, 113 'initialVideoId': item.id,
146 }, 114 },
147 - ).then((_) {  
148 - if (!mounted) return;  
149 - unawaited(  
150 - SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky),  
151 - );  
152 - _reload();  
153 - }); 115 + ).then((_) => _reload());
154 } 116 }
155 } 117 }
156 118
@@ -203,8 +165,7 @@ class _VideoCard extends StatelessWidget { @@ -203,8 +165,7 @@ class _VideoCard extends StatelessWidget {
203 child: Column( 165 child: Column(
204 crossAxisAlignment: CrossAxisAlignment.start, 166 crossAxisAlignment: CrossAxisAlignment.start,
205 children: [ 167 children: [
206 - AspectRatio(  
207 - aspectRatio: 16 / 9, 168 + Expanded(
208 child: ClipRRect( 169 child: ClipRRect(
209 borderRadius: BorderRadius.circular(12.r), 170 borderRadius: BorderRadius.circular(12.r),
210 child: CachedNetworkImage( 171 child: CachedNetworkImage(