drawer change
This commit is contained in:
parent
7935d944a2
commit
c879853816
@ -1,5 +1,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<application
|
<application
|
||||||
android:label="UAE Stats"
|
android:label="UAE Stats"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|||||||
BIN
assets/edit_profile/profile.jpg
Normal file
BIN
assets/edit_profile/profile.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
@ -5,6 +5,7 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
|
import 'package:screenshot/screenshot.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||||
import 'package:uae_stat/config/toast_util.dart';
|
import 'package:uae_stat/config/toast_util.dart';
|
||||||
@ -2134,55 +2135,67 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 5),
|
SizedBox(width: 5),
|
||||||
Stack(
|
GestureDetector(
|
||||||
children: [
|
onTap: () async {
|
||||||
// Image.asset(
|
try {
|
||||||
// UaeNumbersAssetPath.shareUae,
|
// Define share content
|
||||||
// color: Colors.white, // Outline color
|
final String shareLink = 'https://fcsc-da580.web.app'; // Your link
|
||||||
// width: 24, // Slightly larger
|
final String shareText = 'Check this out!';
|
||||||
// height: 24,
|
final String svgAssetPath = 'assets/logos/fcsc.png'; // Your SVG asset path
|
||||||
// ),
|
|
||||||
// Image.asset(
|
|
||||||
// UaeNumbersAssetPath.shareUae,
|
|
||||||
// color: Colors.white,
|
|
||||||
// width: 24,
|
|
||||||
// height: 24,
|
|
||||||
// ),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
try {
|
|
||||||
final svgAssetPath = 'assets/images/sample.svg'; // Update with your actual path
|
|
||||||
final directory = await getTemporaryDirectory();
|
|
||||||
final file = File('${directory.path}/shared_image.svg');
|
|
||||||
|
|
||||||
// Load the SVG asset and write to the temp file
|
// Create a controller to capture the SVG as an image
|
||||||
final svgData = await DefaultAssetBundle.of(context).loadString(svgAssetPath);
|
final screenshotController = ScreenshotController();
|
||||||
await file.writeAsString(svgData);
|
|
||||||
|
|
||||||
// Share the file
|
// Render the SVG off-screen and capture it as PNG
|
||||||
await Share.shareXFiles([XFile(file.path)], text: "Check this out!");
|
final svgWidget = SvgPicture.asset(
|
||||||
} catch (e) {
|
svgAssetPath,
|
||||||
print("Error sharing file: $e");
|
width: 200, // Adjust size as needed
|
||||||
}
|
height: 200,
|
||||||
},
|
);
|
||||||
child: SvgPicture.asset(
|
|
||||||
UaeNumbersAssetPath.share,
|
|
||||||
semanticsLabel: 'share',
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
// Capture the SVG as a PNG
|
||||||
|
final Uint8List? capturedImage = await screenshotController.captureFromWidget(
|
||||||
|
Material(
|
||||||
|
child: svgWidget,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (capturedImage == null) {
|
||||||
|
throw Exception('Failed to capture SVG as image');
|
||||||
|
}
|
||||||
|
|
||||||
// SvgPicture.asset(
|
// Save the captured PNG to a temporary file
|
||||||
// UaeNumbersAssetPath.share,
|
final directory = await getTemporaryDirectory();
|
||||||
// semanticsLabel: 'share',
|
final file = File('${directory.path}/shared_image.png');
|
||||||
// width: 24,
|
await file.writeAsBytes(capturedImage);
|
||||||
// height: 24,
|
|
||||||
// ),
|
// Share the PNG file with text and link
|
||||||
],
|
await Share.shareXFiles(
|
||||||
)
|
[XFile(file.path)],
|
||||||
|
text: '$shareText\n$shareLink',
|
||||||
|
subject: 'Shared Content',
|
||||||
|
);
|
||||||
|
|
||||||
|
// Clean up temporary file
|
||||||
|
await file.delete();
|
||||||
|
} catch (e) {
|
||||||
|
print("Error sharing file: $e");
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('Error sharing: $e')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
child: Icon(
|
||||||
|
Icons.share,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 24,
|
||||||
|
semanticLabel: 'Share',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -544,7 +544,7 @@ class _EditProfileState extends State<EditProfile> {
|
|||||||
? NetworkImage(
|
? NetworkImage(
|
||||||
_avatarUrl) // Load from URL
|
_avatarUrl) // Load from URL
|
||||||
: AssetImage(
|
: AssetImage(
|
||||||
'assets/edit_profile/profile.png')
|
'assets/edit_profile/profile.jpg')
|
||||||
as ImageProvider,
|
as ImageProvider,
|
||||||
child: _avatarUrl.isNotEmpty
|
child: _avatarUrl.isNotEmpty
|
||||||
? FutureBuilder(
|
? FutureBuilder(
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||||
import 'package:uae_stat/config/injector.dart';
|
import 'package:uae_stat/config/injector.dart';
|
||||||
import 'package:uae_stat/domain/repos/t_auth_repo.dart';
|
import 'package:uae_stat/domain/repos/t_auth_repo.dart';
|
||||||
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/bottom_bar_asset_icon_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/bottom_bar_asset_icon_path.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/drawer_asset_icon_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/drawer_asset_icon_path.dart';
|
||||||
@ -787,7 +788,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
)
|
)
|
||||||
: Image(
|
: Image(
|
||||||
image: AssetImage(
|
image: AssetImage(
|
||||||
'assets/edit_profile/profile.png',
|
'assets/edit_profile/profile.jpg',
|
||||||
),
|
),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@ -912,7 +913,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
leading: Icon(Icons.logout),
|
leading: Icon(Icons.logout),
|
||||||
// title: const Text('Logout'),
|
// title: const Text('Logout'),
|
||||||
title: Text(AppLocalizations.of(context)!.logout),
|
title: Text(AppLocalizations.of(context)!.logout),
|
||||||
onTap: () => logout(context),
|
onTap: () => _showLogoutConfirmationDialog(context),
|
||||||
),
|
),
|
||||||
if (userId == 'guest')
|
if (userId == 'guest')
|
||||||
ListTile(
|
ListTile(
|
||||||
@ -1084,3 +1085,85 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void _showLogoutConfirmationDialog(context) {
|
||||||
|
double myheight = MediaQuery.of(context).size.height;
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false, // User must tap a button to dismiss dialog
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5.0), // Rounded corners
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
title: Text(
|
||||||
|
context.translate('Log Out Confirmation', 'تأكيد تسجيل الخروج'),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
content: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Text(
|
||||||
|
context.translate(
|
||||||
|
'Are you sure you want to log out?',
|
||||||
|
'هل أنت متأكد أنك تريد تسجيل الخروج؟'),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
color: Color(0xFF898C81),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // Space buttons evenly
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 120, // Set button width
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
side: BorderSide(
|
||||||
|
color: Color(0xFFAA8E83), // Border color
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
context.translate('Cancel', 'إلغاء'),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFFAA8E83),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 120, // Set button width
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
// Add logout function here
|
||||||
|
},
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
backgroundColor: Color(0xFFAA8E83), // Background color
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
context.translate('Log Out', 'تسجيل الخروج'),
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 10), // Add spacing below buttons
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1177,6 +1177,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.28.0"
|
version: "0.28.0"
|
||||||
|
screenshot:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: screenshot
|
||||||
|
sha256: "63817697a7835e6ce82add4228e15d233b74d42975c143ad8cfe07009fab866b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
sdmx:
|
sdmx:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -26,6 +26,7 @@ dependencies:
|
|||||||
marquee: ^2.2.3
|
marquee: ^2.2.3
|
||||||
url_launcher: ^6.3.1
|
url_launcher: ^6.3.1
|
||||||
path_provider: ^2.1.5
|
path_provider: ^2.1.5
|
||||||
|
screenshot: ^3.0.0
|
||||||
# dynamic_layouts:
|
# dynamic_layouts:
|
||||||
# git:
|
# git:
|
||||||
# url: https://github.com/flutter/packages.git
|
# url: https://github.com/flutter/packages.git
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user