Update codebase
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:tripz_driver/constant/box_name.dart';
|
||||
import 'package:tripz_driver/constant/style.dart';
|
||||
import 'package:tripz_driver/main.dart';
|
||||
import 'package:tripz_driver/views/widgets/my_scafold.dart';
|
||||
import 'package:siro_driver/constant/box_name.dart';
|
||||
import 'package:siro_driver/constant/style.dart';
|
||||
import 'package:siro_driver/main.dart';
|
||||
import 'package:siro_driver/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -26,7 +26,7 @@ class AboutPage extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'Tripz LLC\n${(box.read(BoxName.countryCode)?.toString() ?? 'Syria').tr}',
|
||||
'Siro LLC\n${(box.read(BoxName.countryCode)?.toString() ?? 'Syria').tr}',
|
||||
style: AppStyle.headTitle2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -34,7 +34,7 @@ class AboutPage extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Text(
|
||||
'Tripz is a ride-sharing app designed with your safety and affordability in mind. We connect you with reliable drivers in your area, ensuring a convenient and stress-free travel experience.\n\nHere are some of the key features that set us apart:'
|
||||
'Siro is a ride-sharing app designed with your safety and affordability in mind. We connect you with reliable drivers in your area, ensuring a convenient and stress-free travel experience.\n\nHere are some of the key features that set us apart:'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:tripz_driver/views/widgets/my_scafold.dart';
|
||||
import 'package:tripz_driver/views/widgets/mydialoug.dart';
|
||||
import 'package:siro_driver/views/widgets/my_scafold.dart';
|
||||
import 'package:siro_driver/views/widgets/mydialoug.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -28,7 +28,7 @@ class FrequentlyQuestionsPage extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'Step-by-step instructions on how to request a ride through the Tripz app.'
|
||||
'Step-by-step instructions on how to request a ride through the Siro app.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -43,7 +43,7 @@ class FrequentlyQuestionsPage extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'Tripz offers a variety of vehicle options to suit your needs, including economy, comfort, and luxury. Choose the option that best fits your budget and passenger count.'
|
||||
'Siro offers a variety of vehicle options to suit your needs, including economy, comfort, and luxury. Choose the option that best fits your budget and passenger count.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -58,7 +58,7 @@ class FrequentlyQuestionsPage extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'Tripz offers multiple payment methods for your convenience. Choose between cash payment or credit/debit card payment during ride confirmation.'
|
||||
'Siro offers multiple payment methods for your convenience. Choose between cash payment or credit/debit card payment during ride confirmation.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -73,7 +73,7 @@ class FrequentlyQuestionsPage extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'Yes, you can cancel your ride under certain conditions (e.g., before driver is assigned). See the Tripz cancellation policy for details.'
|
||||
'Yes, you can cancel your ride under certain conditions (e.g., before driver is assigned). See the Siro cancellation policy for details.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -98,7 +98,7 @@ class FrequentlyQuestionsPage extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'Visit our website or contact Tripz support for information on driver registration and requirements.'
|
||||
'Visit our website or contact Siro support for information on driver registration and requirements.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -115,22 +115,22 @@ class FrequentlyQuestionsPage extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'Tripz provides in-app chat functionality to allow you to communicate with your driver or passenger during your ride.'
|
||||
'Siro provides in-app chat functionality to allow you to communicate with your driver or passenger during your ride.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Question 8: What safety measures does Tripz offer?
|
||||
// Question 8: What safety measures does Siro offer?
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'What safety measures does Tripz offer?'.tr,
|
||||
'What safety measures does Siro offer?'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'Tripz prioritizes your safety. We offer features like driver verification, in-app trip tracking, and emergency contact options.'
|
||||
'Siro prioritizes your safety. We offer features like driver verification, in-app trip tracking, and emergency contact options.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tripz_driver/constant/colors.dart';
|
||||
import 'package:tripz_driver/controller/profile/setting_controller.dart';
|
||||
import 'package:tripz_driver/views/lang/languages.dart';
|
||||
import 'package:tripz_driver/views/widgets/my_scafold.dart';
|
||||
import 'package:tripz_driver/views/widgets/mydialoug.dart';
|
||||
import 'package:siro_driver/constant/colors.dart';
|
||||
import 'package:siro_driver/controller/profile/setting_controller.dart';
|
||||
import 'package:siro_driver/views/lang/languages.dart';
|
||||
import 'package:siro_driver/views/widgets/mydialoug.dart';
|
||||
|
||||
// تأكد من صحة مسارات الاستيراد هذه
|
||||
import '../../../../controller/functions/vibrate.dart'; // Controller with isVibrate
|
||||
import '../../../auth/country_widget.dart';
|
||||
import '../../../widgets/ui/siro_ui.dart';
|
||||
import 'about_us.dart';
|
||||
import 'frequantly_question.dart';
|
||||
import 'using_app_page.dart';
|
||||
@@ -22,15 +21,13 @@ class SettingsCaptain extends StatelessWidget {
|
||||
final settingsController = Get.put(SettingController());
|
||||
final homeController = Get.put(HomePageController());
|
||||
|
||||
return MyScafolld(
|
||||
return SiroPage(
|
||||
title: 'Settings'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 20.0),
|
||||
padding: SiroUi.pageInsets,
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
// --- القسم الأول: عام ---
|
||||
_buildSectionHeader('General'.tr, context),
|
||||
SiroSectionTitle('General'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
_buildListTile(
|
||||
@@ -53,10 +50,8 @@ class SettingsCaptain extends StatelessWidget {
|
||||
// ),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// --- القسم الثاني: تفضيلات التطبيق ---
|
||||
_buildSectionHeader('App Preferences'.tr, context),
|
||||
SiroSectionTitle('App Preferences'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
_buildSwitchTile(
|
||||
@@ -96,10 +91,8 @@ class SettingsCaptain extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// --- القسم الثالث: المساعدة والدعم ---
|
||||
_buildSectionHeader('Help & Support'.tr, context),
|
||||
SiroSectionTitle('Help & Support'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
_buildListTile(
|
||||
@@ -119,18 +112,17 @@ class SettingsCaptain extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// --- القسم الرابع: تسجيل الخروج ---
|
||||
_buildSectionHeader('Account'.tr, context),
|
||||
SiroSectionTitle('Account'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.logout, color: Colors.red),
|
||||
leading: const SiroIconBadge(Icons.logout_rounded,
|
||||
color: AppColor.redColor),
|
||||
title: Text(
|
||||
'Logout'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.red, fontWeight: FontWeight.w500),
|
||||
color: AppColor.redColor, fontWeight: FontWeight.w600),
|
||||
),
|
||||
onTap: () {
|
||||
MyDialog().getDialog(
|
||||
@@ -145,34 +137,17 @@ class SettingsCaptain extends StatelessWidget {
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// ويدجت لبناء عنوان كل قسم
|
||||
Widget _buildSectionHeader(String title, BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, bottom: 12.0),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleSmall?.copyWith(
|
||||
color: Colors.grey.shade600,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ويدجت لبناء بطاقة الإعدادات
|
||||
// ويدجت لبناء بطاقة الإعدادات — تجمع عناصر القسم داخل سطح واحد.
|
||||
Widget _buildSettingsCard({required List<Widget> children}) {
|
||||
return Card(
|
||||
elevation: 2,
|
||||
shadowColor: Colors.black.withOpacity(0.1),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
clipBehavior: Clip.antiAlias, // مهم لجعل splash effect داخل حدود البطاقة
|
||||
return SiroCard(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Column(children: children),
|
||||
);
|
||||
}
|
||||
@@ -184,14 +159,18 @@ class SettingsCaptain extends StatelessWidget {
|
||||
String? subtitle,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: Colors.grey.shade700),
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
subtitle: subtitle != null ? Text(subtitle) : null,
|
||||
trailing:
|
||||
const Icon(Icons.arrow_forward_ios, size: 16, color: Colors.grey),
|
||||
onTap: onTap,
|
||||
);
|
||||
return Builder(builder: (context) {
|
||||
return ListTile(
|
||||
leading: SiroIconBadge(icon, color: SiroUi.interactive(context)),
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w600)),
|
||||
subtitle: subtitle != null
|
||||
? Text(subtitle, style: Theme.of(context).textTheme.bodySmall)
|
||||
: null,
|
||||
trailing: Icon(Icons.arrow_forward_ios,
|
||||
size: 14, color: SiroUi.subtle(context)),
|
||||
onTap: onTap,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// ويدجت لبناء عنصر يحتوي على مفتاح تفعيل/إلغاء (Switch)
|
||||
@@ -207,15 +186,19 @@ class SettingsCaptain extends StatelessWidget {
|
||||
return GetBuilder<T>(
|
||||
init: controller,
|
||||
builder: (ctrl) {
|
||||
return SwitchListTile(
|
||||
secondary: Icon(icon, color: color ?? Colors.grey.shade700),
|
||||
title:
|
||||
Text(title, style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
subtitle: Text(subtitle),
|
||||
value: valueGetter(ctrl),
|
||||
onChanged: (value) => onChanged(ctrl),
|
||||
activeColor: AppColor.primaryColor,
|
||||
);
|
||||
return Builder(builder: (context) {
|
||||
return SwitchListTile(
|
||||
secondary: SiroIconBadge(icon,
|
||||
color: color ?? SiroUi.interactive(context)),
|
||||
title:
|
||||
Text(title, style: const TextStyle(fontWeight: FontWeight.w600)),
|
||||
subtitle: Text(subtitle,
|
||||
style: Theme.of(context).textTheme.bodySmall),
|
||||
value: valueGetter(ctrl),
|
||||
onChanged: (value) => onChanged(ctrl),
|
||||
activeThumbColor: SiroUi.interactive(context),
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tripz_driver/views/widgets/my_scafold.dart';
|
||||
import 'package:siro_driver/views/widgets/my_scafold.dart';
|
||||
|
||||
// 1. إنشاء Class لتمثيل بيانات كل سؤال وجواب
|
||||
class FaqItem {
|
||||
@@ -43,13 +43,13 @@ class UsingAppPage extends StatelessWidget {
|
||||
question: "What is the feature of our wallet?".tr,
|
||||
icon: Icons.account_balance_wallet_outlined,
|
||||
answer: Text(
|
||||
'''Tripz Wallet Features:
|
||||
'''Siro Wallet Features:
|
||||
|
||||
- Transfer money multiple times.
|
||||
- Transfer to anyone.
|
||||
- Make purchases.
|
||||
- Charge your account.
|
||||
- Charge a friend's Tripz account.
|
||||
- Charge a friend's Siro account.
|
||||
- Store your money with us and receive it in your bank as a monthly salary.'''
|
||||
.tr,
|
||||
style:
|
||||
@@ -57,10 +57,10 @@ class UsingAppPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
FaqItem(
|
||||
question: "What is Types of Trips in Tripz?".tr,
|
||||
question: "What is Types of Trips in Siro?".tr,
|
||||
icon: Icons.map_outlined,
|
||||
answer: Text(
|
||||
'''Types of Trips in Tripz:
|
||||
'''Types of Trips in Siro:
|
||||
|
||||
- Comfort: For cars newer than 2017 with air conditioning.
|
||||
- Lady: For girl drivers.
|
||||
|
||||
@@ -1,81 +1,70 @@
|
||||
import 'package:tripz_driver/constant/info.dart';
|
||||
import 'package:siro_driver/constant/info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
||||
|
||||
import '../../../../controller/home/captin/help/video_controller.dart';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import '../../../widgets/ui/siro_ui.dart';
|
||||
|
||||
class VideoListPage extends StatelessWidget {
|
||||
VideoListPage({super.key});
|
||||
|
||||
final VideoController videoController = Get.put(VideoController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('Videos Tutorials'.tr),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 10.0), // Outer padding around the list
|
||||
child: GetBuilder<VideoController>(
|
||||
builder: (videoController) {
|
||||
return ListView.builder(
|
||||
itemCount: videoController.videos.length,
|
||||
itemBuilder: (context, index) {
|
||||
final video = videoController.videos[index];
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 8.0), // Spacing between each card
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.white,
|
||||
borderRadius:
|
||||
BorderRadius.circular(12.0), // Rounded corners
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: CupertinoColors.systemGrey.withOpacity(0.3),
|
||||
offset: const Offset(
|
||||
0, 4), // Offset for shadow to appear below
|
||||
blurRadius: 10.0, // Blur for softer shadow effect
|
||||
),
|
||||
],
|
||||
border: Border.all(
|
||||
color: CupertinoColors.systemGrey4,
|
||||
width: 0.5, // Subtle border for a refined iOS-like look
|
||||
),
|
||||
),
|
||||
child: CupertinoListTile(
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4.0),
|
||||
child: Text(
|
||||
video['title'],
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
return SiroPage(
|
||||
title: 'Videos Tutorials'.tr,
|
||||
padding: SiroUi.pageInsets,
|
||||
body: GetBuilder<VideoController>(
|
||||
builder: (videoController) {
|
||||
if (videoController.videos.isEmpty) {
|
||||
return SiroEmptyState(
|
||||
icon: Icons.video_library_rounded,
|
||||
title: 'No videos available'.tr,
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: videoController.videos.length,
|
||||
itemBuilder: (context, index) {
|
||||
final video = videoController.videos[index];
|
||||
return SiroCard(
|
||||
onTap: () =>
|
||||
Get.to(() => VideoPlayerPage1(videoUrl: video['url'])),
|
||||
child: Row(
|
||||
children: [
|
||||
SiroIconBadge(Icons.play_arrow_rounded,
|
||||
color: SiroUi.interactive(context), size: 24),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
video['title'] ?? '',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
video['description'] ?? '',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Text(
|
||||
video['description'],
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.systemGrey,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
// Navigate to video player page (iOS-style)
|
||||
Get.to(() => VideoPlayerPage1(videoUrl: video['url']));
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
Icon(Icons.arrow_forward_ios_rounded,
|
||||
size: 13, color: SiroUi.subtle(context)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -84,7 +73,7 @@ class VideoListPage extends StatelessWidget {
|
||||
class VideoPlayerPage extends StatelessWidget {
|
||||
final String videoUrl;
|
||||
|
||||
VideoPlayerPage({required this.videoUrl});
|
||||
VideoPlayerPage({super.key, required this.videoUrl});
|
||||
|
||||
final VideoController videoController = Get.put(VideoController());
|
||||
|
||||
@@ -93,51 +82,45 @@ class VideoPlayerPage extends StatelessWidget {
|
||||
// Initialize the video when the page is loaded
|
||||
videoController.initializeVideo(videoUrl);
|
||||
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(
|
||||
middle: Text(AppInformation.appName),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: GetBuilder<VideoController>(
|
||||
builder: (controller) {
|
||||
if (!controller.videoPlayerController.value.isInitialized) {
|
||||
return const CircularProgressIndicator(); // Show loading indicator while initializing
|
||||
}
|
||||
return SiroPage(
|
||||
title: AppInformation.appName,
|
||||
body: Center(
|
||||
child: GetBuilder<VideoController>(
|
||||
builder: (controller) {
|
||||
if (!controller.videoPlayerController.value.isInitialized) {
|
||||
return const SiroLoading();
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Video player widget
|
||||
AspectRatio(
|
||||
aspectRatio:
|
||||
controller.videoPlayerController.value.aspectRatio,
|
||||
// child: VideoPlayer(controller.videoPlayerController),
|
||||
child: VideoPlayer(controller.videoPlayerController),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Video player widget
|
||||
AspectRatio(
|
||||
aspectRatio:
|
||||
controller.videoPlayerController.value.aspectRatio,
|
||||
child: VideoPlayer(controller.videoPlayerController),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Play/pause button
|
||||
CupertinoButton(
|
||||
onPressed: () {
|
||||
if (controller.videoPlayerController.value.isPlaying) {
|
||||
controller.pause();
|
||||
} else {
|
||||
controller.play();
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
controller.videoPlayerController.value.isPlaying
|
||||
? CupertinoIcons.pause
|
||||
: CupertinoIcons.play_arrow,
|
||||
color: CupertinoColors.activeBlue,
|
||||
size: 30,
|
||||
),
|
||||
// Play/pause button
|
||||
IconButton.filled(
|
||||
iconSize: 32,
|
||||
onPressed: () {
|
||||
if (controller.videoPlayerController.value.isPlaying) {
|
||||
controller.pause();
|
||||
} else {
|
||||
controller.play();
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
controller.videoPlayerController.value.isPlaying
|
||||
? Icons.pause_rounded
|
||||
: Icons.play_arrow_rounded,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -147,15 +130,26 @@ class VideoPlayerPage extends StatelessWidget {
|
||||
class VideoPlayerPage1 extends StatelessWidget {
|
||||
final String videoUrl;
|
||||
|
||||
const VideoPlayerPage1({required this.videoUrl});
|
||||
const VideoPlayerPage1({super.key, required this.videoUrl});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Extract the video ID from the URL
|
||||
String videoId = YoutubePlayer.convertUrlToId(videoUrl)!;
|
||||
final String? videoId = YoutubePlayer.convertUrlToId(videoUrl);
|
||||
|
||||
// Create a YoutubePlayerController
|
||||
final YoutubePlayerController _controller = YoutubePlayerController(
|
||||
// رابط غير صالح كان يرمي `Null check operator used on a null value`
|
||||
// ويُسقط الشاشة بيضاء بدل رسالة مفهومة.
|
||||
if (videoId == null) {
|
||||
return SiroPage(
|
||||
title: AppInformation.appName,
|
||||
body: SiroEmptyState(
|
||||
icon: Icons.videocam_off_rounded,
|
||||
title: 'Video unavailable'.tr,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final YoutubePlayerController controller = YoutubePlayerController(
|
||||
initialVideoId: videoId,
|
||||
flags: const YoutubePlayerFlags(
|
||||
autoPlay: true,
|
||||
@@ -166,24 +160,28 @@ class VideoPlayerPage1 extends StatelessWidget {
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Stack(
|
||||
children: [
|
||||
// Full-screen YouTube player
|
||||
Positioned.fill(
|
||||
child: YoutubePlayer(
|
||||
controller: _controller,
|
||||
controller: controller,
|
||||
showVideoProgressIndicator: true,
|
||||
),
|
||||
),
|
||||
// Overlay back button in the top left corner for exit
|
||||
Positioned(
|
||||
top: 40.0,
|
||||
left: 16.0,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
// زر الخروج — كان `left` ثابتاً فيقع تحت الإبهام الخطأ في العربية
|
||||
SafeArea(
|
||||
child: PositionedDirectional(
|
||||
top: 8,
|
||||
start: 8,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.black45,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user