improve video player
This commit is contained in:
parent
d54d466e3d
commit
9d9bb16d9e
|
|
@ -5,6 +5,7 @@ class DidvanPlusModel {
|
|||
final String image;
|
||||
final String file;
|
||||
final String publishedAt;
|
||||
final int? duration;
|
||||
|
||||
DidvanPlusModel({
|
||||
required this.id,
|
||||
|
|
@ -13,6 +14,7 @@ class DidvanPlusModel {
|
|||
required this.image,
|
||||
required this.file,
|
||||
required this.publishedAt,
|
||||
this.duration,
|
||||
});
|
||||
|
||||
factory DidvanPlusModel.fromJson(Map<String, dynamic> json) {
|
||||
|
|
@ -23,6 +25,7 @@ class DidvanPlusModel {
|
|||
image: json['image'],
|
||||
file: json['file'],
|
||||
publishedAt: json['publishedAt'],
|
||||
duration: json['duration'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// ignore_for_file: deprecated_member_use
|
||||
|
||||
import 'package:didvan/config/design_config.dart';
|
||||
import 'package:didvan/config/theme_data.dart';
|
||||
import 'package:didvan/models/didvan_plus_model.dart';
|
||||
import 'package:didvan/services/network/request_helper.dart';
|
||||
import 'package:didvan/views/didvan_plus/didvan_plus_video_player.dart';
|
||||
|
|
@ -9,6 +10,8 @@ import 'package:didvan/views/widgets/didvan/text.dart';
|
|||
import 'package:didvan/views/widgets/home_app_bar.dart';
|
||||
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:persian_number_utility/persian_number_utility.dart';
|
||||
|
||||
class DidvanPlusListPage extends StatelessWidget {
|
||||
final List<DidvanPlusModel> items;
|
||||
|
|
@ -28,10 +31,7 @@ class DidvanPlusListPage extends StatelessWidget {
|
|||
padding: EdgeInsets.zero,
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: HomeAppBar(
|
||||
showBackButton: false,
|
||||
title: 'دیدوان پلاس',
|
||||
),
|
||||
child: HomeAppBar(),
|
||||
),
|
||||
SliverFillRemaining(
|
||||
child: Center(
|
||||
|
|
@ -46,18 +46,48 @@ class DidvanPlusListPage extends StatelessWidget {
|
|||
appBarData: null,
|
||||
padding: EdgeInsets.zero,
|
||||
slivers: [
|
||||
const SliverToBoxAdapter(
|
||||
child: HomeAppBar(
|
||||
showBackButton: true,
|
||||
title: 'دیدوان پلاس',
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(90.0),
|
||||
child: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
flexibleSpace: SafeArea(
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Center(
|
||||
child: SvgPicture.asset(
|
||||
'lib/assets /images/logos/logo-horizontal-light.svg',
|
||||
height: 55,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: SvgPicture.asset(
|
||||
'lib/assets/icons/arrow-left.svg',
|
||||
color: Theme.of(context).colorScheme.caption,
|
||||
height: 24,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 0.75,
|
||||
childAspectRatio: 0.85,
|
||||
crossAxisSpacing: 12,
|
||||
mainAxisSpacing: 12,
|
||||
),
|
||||
|
|
@ -74,6 +104,22 @@ class DidvanPlusListPage extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
String _formatDate(String dateStr) {
|
||||
try {
|
||||
final date = DateTime.parse(dateStr);
|
||||
return date.toPersianDateStr();
|
||||
} catch (e) {
|
||||
return dateStr;
|
||||
}
|
||||
}
|
||||
|
||||
String _formatDuration(int? duration) {
|
||||
if (duration == null) return '';
|
||||
final minutes = duration ~/ 60;
|
||||
final seconds = duration % 60;
|
||||
return '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
Widget _buildGridItem(BuildContext context, DidvanPlusModel item) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
|
|
@ -137,10 +183,11 @@ class DidvanPlusListPage extends StatelessWidget {
|
|||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 4, 12, 8),
|
||||
padding: const EdgeInsets.fromLTRB(12, 2, 12, 6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DidvanText(
|
||||
item.title,
|
||||
|
|
@ -153,15 +200,49 @@ class DidvanPlusListPage extends StatelessWidget {
|
|||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
DidvanText(
|
||||
item.description,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Colors.grey,
|
||||
const SizedBox(height: 3),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset('lib/assets/icons/calendar.svg'),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: DidvanText(
|
||||
_formatDate(item.publishedAt),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.caption,
|
||||
fontSize: 10),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (item.duration != null) ...[
|
||||
const SizedBox(height: 3),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'lib/assets/icons/clock.svg',
|
||||
color: Theme.of(context).colorScheme.caption,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
DidvanText(
|
||||
_formatDuration(item.duration).toPersianDigit(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.caption,
|
||||
fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class _DidvanPlusVideoPlayerState extends State<DidvanPlusVideoPlayer> {
|
|||
children: [
|
||||
Image.network(
|
||||
'${RequestHelper.baseUrl}${widget.video.image}',
|
||||
fit: BoxFit.cover,
|
||||
fit: BoxFit.fitWidth,
|
||||
),
|
||||
const Center(
|
||||
child: CircularProgressIndicator(
|
||||
|
|
|
|||
|
|
@ -58,13 +58,13 @@ class _DidvanVoiceSectionState extends State<DidvanVoiceSection> {
|
|||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
child: Image.network(
|
||||
imageUrl,
|
||||
width: 80,
|
||||
height: 130,
|
||||
width: 110,
|
||||
height: 150,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return Container(
|
||||
width: 80,
|
||||
height: 130,
|
||||
width: 110,
|
||||
height: 150,
|
||||
color: Colors.grey.shade800,
|
||||
child: const Icon(Icons.music_note, color: Colors.white),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ FLUTTER_APPLICATION_PATH=C:\Flutter Projects\didvan-app\didvan-app
|
|||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||
FLUTTER_BUILD_DIR=build
|
||||
FLUTTER_BUILD_NAME=5.0.0
|
||||
FLUTTER_BUILD_NUMBER=7002
|
||||
FLUTTER_BUILD_NUMBER=7006
|
||||
DART_OBFUSCATION=false
|
||||
TRACK_WIDGET_CREATION=true
|
||||
TREE_SHAKE_ICONS=false
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export "FLUTTER_APPLICATION_PATH=C:\Flutter Projects\didvan-app\didvan-app"
|
|||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||
export "FLUTTER_BUILD_DIR=build"
|
||||
export "FLUTTER_BUILD_NAME=5.0.0"
|
||||
export "FLUTTER_BUILD_NUMBER=7002"
|
||||
export "FLUTTER_BUILD_NUMBER=7006"
|
||||
export "DART_OBFUSCATION=false"
|
||||
export "TRACK_WIDGET_CREATION=true"
|
||||
export "TREE_SHAKE_ICONS=false"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 5.0.0+7005
|
||||
version: 5.0.0+7006
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue