mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-06 15:21:21 +08:00

Jumping around between the widgets / screens and outside is bit confusing. Also this way, I can add the stories right here.
45 lines
1.1 KiB
Dart
45 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:gitjournal/analytics/analytics.dart';
|
|
import 'package:gitjournal/features.dart';
|
|
import 'package:gitjournal/settings/app_settings.dart';
|
|
|
|
class ProOverlay extends StatelessWidget {
|
|
final Widget child;
|
|
final Feature feature;
|
|
|
|
ProOverlay({required this.child, required this.feature}) {
|
|
assert(feature.pro == true);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var appSettings = Provider.of<AppSettings>(context);
|
|
|
|
if (appSettings.proMode) {
|
|
return child;
|
|
}
|
|
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Banner(
|
|
message: tr('pro'),
|
|
location: BannerLocation.topEnd,
|
|
color: Theme.of(context).accentColor,
|
|
child: IgnorePointer(child: Opacity(opacity: 0.5, child: child)),
|
|
),
|
|
onTap: () {
|
|
Navigator.pushNamed(context, "/purchase");
|
|
|
|
logEvent(
|
|
Event.PurchaseScreenOpen,
|
|
parameters: {"from": feature.featureName},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|