improve video player
This commit is contained in:
parent
d54d466e3d
commit
9d9bb16d9e
|
|
@ -5,6 +5,7 @@ class DidvanPlusModel {
|
||||||
final String image;
|
final String image;
|
||||||
final String file;
|
final String file;
|
||||||
final String publishedAt;
|
final String publishedAt;
|
||||||
|
final int? duration;
|
||||||
|
|
||||||
DidvanPlusModel({
|
DidvanPlusModel({
|
||||||
required this.id,
|
required this.id,
|
||||||
|
|
@ -13,6 +14,7 @@ class DidvanPlusModel {
|
||||||
required this.image,
|
required this.image,
|
||||||
required this.file,
|
required this.file,
|
||||||
required this.publishedAt,
|
required this.publishedAt,
|
||||||
|
this.duration,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory DidvanPlusModel.fromJson(Map<String, dynamic> json) {
|
factory DidvanPlusModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
|
@ -23,6 +25,7 @@ class DidvanPlusModel {
|
||||||
image: json['image'],
|
image: json['image'],
|
||||||
file: json['file'],
|
file: json['file'],
|
||||||
publishedAt: json['publishedAt'],
|
publishedAt: json['publishedAt'],
|
||||||
|
duration: json['duration'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// ignore_for_file: deprecated_member_use
|
// ignore_for_file: deprecated_member_use
|
||||||
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
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/models/didvan_plus_model.dart';
|
||||||
import 'package:didvan/services/network/request_helper.dart';
|
import 'package:didvan/services/network/request_helper.dart';
|
||||||
import 'package:didvan/views/didvan_plus/didvan_plus_video_player.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/home_app_bar.dart';
|
||||||
import 'package:didvan/views/widgets/skeleton_image.dart';
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:flutter/material.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 {
|
class DidvanPlusListPage extends StatelessWidget {
|
||||||
final List<DidvanPlusModel> items;
|
final List<DidvanPlusModel> items;
|
||||||
|
|
@ -28,10 +31,7 @@ class DidvanPlusListPage extends StatelessWidget {
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: HomeAppBar(
|
child: HomeAppBar(),
|
||||||
showBackButton: false,
|
|
||||||
title: 'دیدوان پلاس',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SliverFillRemaining(
|
SliverFillRemaining(
|
||||||
child: Center(
|
child: Center(
|
||||||
|
|
@ -46,18 +46,48 @@ class DidvanPlusListPage extends StatelessWidget {
|
||||||
appBarData: null,
|
appBarData: null,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
slivers: [
|
slivers: [
|
||||||
const SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: HomeAppBar(
|
child: PreferredSize(
|
||||||
showBackButton: true,
|
preferredSize: const Size.fromHeight(90.0),
|
||||||
title: 'دیدوان پلاس',
|
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(
|
SliverPadding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
sliver: SliverGrid(
|
sliver: SliverGrid(
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
childAspectRatio: 0.75,
|
childAspectRatio: 0.85,
|
||||||
crossAxisSpacing: 12,
|
crossAxisSpacing: 12,
|
||||||
mainAxisSpacing: 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) {
|
Widget _buildGridItem(BuildContext context, DidvanPlusModel item) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
@ -137,10 +183,11 @@ class DidvanPlusListPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 4, 12, 8),
|
padding: const EdgeInsets.fromLTRB(12, 2, 12, 6),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
DidvanText(
|
DidvanText(
|
||||||
item.title,
|
item.title,
|
||||||
|
|
@ -153,15 +200,49 @@ class DidvanPlusListPage extends StatelessWidget {
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 3),
|
||||||
DidvanText(
|
Row(
|
||||||
item.description,
|
children: [
|
||||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
SvgPicture.asset('lib/assets/icons/calendar.svg'),
|
||||||
color: Colors.grey,
|
const SizedBox(width: 4),
|
||||||
),
|
Flexible(
|
||||||
maxLines: 2,
|
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,
|
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: [
|
children: [
|
||||||
Image.network(
|
Image.network(
|
||||||
'${RequestHelper.baseUrl}${widget.video.image}',
|
'${RequestHelper.baseUrl}${widget.video.image}',
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.fitWidth,
|
||||||
),
|
),
|
||||||
const Center(
|
const Center(
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,13 @@ class _DidvanVoiceSectionState extends State<DidvanVoiceSection> {
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
imageUrl,
|
imageUrl,
|
||||||
width: 80,
|
width: 110,
|
||||||
height: 130,
|
height: 150,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
errorBuilder: (context, error, stackTrace) {
|
errorBuilder: (context, error, stackTrace) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 80,
|
width: 110,
|
||||||
height: 130,
|
height: 150,
|
||||||
color: Colors.grey.shade800,
|
color: Colors.grey.shade800,
|
||||||
child: const Icon(Icons.music_note, color: Colors.white),
|
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
|
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||||
FLUTTER_BUILD_DIR=build
|
FLUTTER_BUILD_DIR=build
|
||||||
FLUTTER_BUILD_NAME=5.0.0
|
FLUTTER_BUILD_NAME=5.0.0
|
||||||
FLUTTER_BUILD_NUMBER=7002
|
FLUTTER_BUILD_NUMBER=7006
|
||||||
DART_OBFUSCATION=false
|
DART_OBFUSCATION=false
|
||||||
TRACK_WIDGET_CREATION=true
|
TRACK_WIDGET_CREATION=true
|
||||||
TREE_SHAKE_ICONS=false
|
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 "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||||
export "FLUTTER_BUILD_DIR=build"
|
export "FLUTTER_BUILD_DIR=build"
|
||||||
export "FLUTTER_BUILD_NAME=5.0.0"
|
export "FLUTTER_BUILD_NAME=5.0.0"
|
||||||
export "FLUTTER_BUILD_NUMBER=7002"
|
export "FLUTTER_BUILD_NUMBER=7006"
|
||||||
export "DART_OBFUSCATION=false"
|
export "DART_OBFUSCATION=false"
|
||||||
export "TRACK_WIDGET_CREATION=true"
|
export "TRACK_WIDGET_CREATION=true"
|
||||||
export "TREE_SHAKE_ICONS=false"
|
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.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 5.0.0+7005
|
version: 5.0.0+7006
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue