Added option to share the app via qr-code
This commit is contained in:
parent
7b18fed51d
commit
a479fc5ebd
@ -1,9 +1,9 @@
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_app_badger/flutter_app_badger.dart';
|
||||
import 'package:marianum_mobile/app.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../app.dart';
|
||||
import '../model/chatList/chatListProps.dart';
|
||||
import '../model/chatList/chatProps.dart';
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import '../../../widget/ListItem.dart';
|
||||
import '../../settings/settings.dart';
|
||||
@ -9,6 +8,7 @@ import 'gradeAverages/gradeAverage.dart';
|
||||
import 'holidays/holidays.dart';
|
||||
import 'message/message.dart';
|
||||
import 'roomplan/roomplan.dart';
|
||||
import 'share/selectShareTypeDialog.dart';
|
||||
|
||||
class Overhang extends StatelessWidget {
|
||||
const Overhang({Key? key}) : super(key: key);
|
||||
@ -33,20 +33,8 @@ class Overhang extends StatelessWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.share_outlined),
|
||||
title: const Text("Teile die App"),
|
||||
onTap: () {
|
||||
Share.share(
|
||||
sharePositionOrigin: Rect.fromCenter(
|
||||
center: const Offset(0, 0),
|
||||
width: 0,
|
||||
height: 0,
|
||||
),
|
||||
subject: "App Teilen",
|
||||
"Hol dir die für das Marianum maßgeschneiderte App:"
|
||||
"\n\nAndroid: https://play.google.com/store/apps/details?id=eu.mhsl.marianum.mobile.client "
|
||||
"\niOS: https://apps.apple.com/us/app/marianum-fulda/id6458789560 "
|
||||
"\n\nViel Spaß!"
|
||||
);
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: () => showDialog(context: context, builder: (context) => const SelectShareTypeDialog())
|
||||
),
|
||||
],
|
||||
),
|
||||
|
41
lib/view/pages/more/share/appSharePlatformView.dart
Normal file
41
lib/view/pages/more/share/appSharePlatformView.dart
Normal file
@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
class AppSharePlatformView extends StatelessWidget {
|
||||
final String title;
|
||||
final String url;
|
||||
const AppSharePlatformView(this.title, this.url, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color foregroundColor = Theme.of(context).colorScheme.onBackground;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(title, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 30),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: foregroundColor, width: 10),
|
||||
),
|
||||
child: QrImageView(
|
||||
data: url,
|
||||
version: QrVersions.auto,
|
||||
size: 200,
|
||||
dataModuleStyle: QrDataModuleStyle(
|
||||
color: foregroundColor,
|
||||
dataModuleShape: QrDataModuleShape.square
|
||||
),
|
||||
eyeStyle: QrEyeStyle(
|
||||
color: foregroundColor,
|
||||
eyeShape: QrEyeShape.square,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
36
lib/view/pages/more/share/qrShareView.dart
Normal file
36
lib/view/pages/more/share/qrShareView.dart
Normal file
@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'appSharePlatformView.dart';
|
||||
|
||||
class QrShareView extends StatefulWidget {
|
||||
const QrShareView({super.key});
|
||||
|
||||
@override
|
||||
State<QrShareView> createState() => _QrShareViewState();
|
||||
}
|
||||
|
||||
class _QrShareViewState extends State<QrShareView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTabController(
|
||||
length: 2,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Teile die App"),
|
||||
bottom: const TabBar(
|
||||
tabs: [
|
||||
Tab(icon: Icon(Icons.android_outlined), text: "Android"),
|
||||
Tab(icon: Icon(Icons.apple_outlined), text: "iOS & iPadOS"),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: const TabBarView(
|
||||
children: [
|
||||
AppSharePlatformView("Für Android", "https://play.google.com/store/apps/details?id=eu.mhsl.marianum.mobile.client"),
|
||||
AppSharePlatformView("Für iOS & iPad", "https://apps.apple.com/us/app/marianum-fulda/id6458789560"),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
49
lib/view/pages/more/share/selectShareTypeDialog.dart
Normal file
49
lib/view/pages/more/share/selectShareTypeDialog.dart
Normal file
@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'qrShareView.dart';
|
||||
|
||||
class SelectShareTypeDialog extends StatelessWidget {
|
||||
const SelectShareTypeDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LoaderOverlay(
|
||||
child: SimpleDialog(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.qr_code_2_outlined),
|
||||
title: const Text("Per QR-Code"),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => const QrShareView()));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.link_outlined),
|
||||
title: const Text("Per Link"),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: () {
|
||||
context.loaderOverlay.show();
|
||||
Share.share(
|
||||
sharePositionOrigin: Rect.fromCenter(
|
||||
center: const Offset(0, 0),
|
||||
width: 0,
|
||||
height: 0,
|
||||
),
|
||||
subject: "App Teilen",
|
||||
"Hol dir die für das Marianum maßgeschneiderte App:"
|
||||
"\n\nAndroid: https://play.google.com/store/apps/details?id=eu.mhsl.marianum.mobile.client "
|
||||
"\niOS: https://apps.apple.com/us/app/marianum-fulda/id6458789560 "
|
||||
"\n\nViel Spaß!"
|
||||
).then((_) {
|
||||
context.loaderOverlay.hide();
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 0.0.3+26
|
||||
version: 0.0.3+27
|
||||
|
||||
environment:
|
||||
sdk: '>3.0.0'
|
||||
@ -92,6 +92,7 @@ dependencies:
|
||||
bottom_sheet: ^4.0.0
|
||||
device_info_plus: ^9.0.3
|
||||
flutter_app_badger: ^1.5.0
|
||||
qr_flutter: ^4.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
x
Reference in New Issue
Block a user