Files
GitJournal/lib/widgets/pro_overlay.dart
Vishesh Handa 657721adc6 Update dart-git and stop using the Result class
Instead we're going to move back to standard exceptions.

Using a custom Result class has created far far more problems
- The Stacktraces aren't always right
- Sometimes one forgets to check the Result error
- All other exception throwing code needing to be converted to Results
- Non idiomatic Dart code

I think it's better to just go back to exceptions. They have their
problems, but overall, I think it's a better approach.
2023-11-24 14:03:30 +01:00

36 lines
935 B
Dart

/*
* SPDX-FileCopyrightText: 2019-2021 Vishesh Handa <me@vhanda.in>
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import 'package:flutter/material.dart';
import 'package:gitjournal/l10n.dart';
import 'package:gitjournal/settings/app_config.dart';
import 'package:provider/provider.dart';
class ProOverlay extends StatelessWidget {
final Widget child;
const ProOverlay({required this.child});
@override
Widget build(BuildContext context) {
var appConfig = context.watch<AppConfig>();
if (appConfig.proMode) return child;
return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Banner(
message: context.loc.pro,
location: BannerLocation.topEnd,
color: Theme.of(context).disabledColor,
child: IgnorePointer(child: Opacity(opacity: 0.5, child: child)),
),
onTap: () {
Navigator.pushNamed(context, "/purchase");
},
);
}
}