mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-01-18 11:17:06 +00:00
Add PrimaryButton component (#221)
This commit is contained in:
parent
991837676a
commit
a28b922494
2 changed files with 30 additions and 2 deletions
28
lib/components/buttons/PrimaryButton.dart
Normal file
28
lib/components/buttons/PrimaryButton.dart
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PrimaryButton extends StatelessWidget {
|
||||||
|
const PrimaryButton({Key? key, required this.child, this.onPressed}) : super(key: key);
|
||||||
|
|
||||||
|
final Widget child;
|
||||||
|
final GestureTapCallback? onPressed;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
return FilledButton(
|
||||||
|
onPressed: onPressed,
|
||||||
|
child: child,
|
||||||
|
style: FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.primary));
|
||||||
|
} else {
|
||||||
|
// Workaround for https://github.com/flutter/flutter/issues/161590
|
||||||
|
final themeData = CupertinoTheme.of(context);
|
||||||
|
return CupertinoTheme(
|
||||||
|
data: themeData.copyWith(primaryColor: CupertinoColors.white),
|
||||||
|
child: CupertinoButton(
|
||||||
|
child: child, onPressed: onPressed, color: CupertinoColors.secondaryLabel.resolveFrom(context)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ import 'package:mobile_nebula/screens/siteConfig/ScanQRScreen.dart';
|
||||||
import 'package:mobile_nebula/services/share.dart';
|
import 'package:mobile_nebula/services/share.dart';
|
||||||
import 'package:mobile_nebula/services/utils.dart';
|
import 'package:mobile_nebula/services/utils.dart';
|
||||||
|
|
||||||
|
import '../../components/buttons/PrimaryButton.dart';
|
||||||
import 'CertificateDetailsScreen.dart';
|
import 'CertificateDetailsScreen.dart';
|
||||||
|
|
||||||
class CertificateResult {
|
class CertificateResult {
|
||||||
|
@ -152,9 +153,8 @@ class _AddCertificateScreenState extends State<AddCertificateScreen> {
|
||||||
padding: EdgeInsets.only(top: 20, bottom: 10, left: 10, right: 10),
|
padding: EdgeInsets.only(top: 20, bottom: 10, left: 10, right: 10),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: PlatformElevatedButton(
|
child: PrimaryButton(
|
||||||
child: Text('Show/Import Private Key'),
|
child: Text('Show/Import Private Key'),
|
||||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
|
||||||
onPressed: () => Utils.confirmDelete(context, 'Show/Import Private Key?', () {
|
onPressed: () => Utils.confirmDelete(context, 'Show/Import Private Key?', () {
|
||||||
setState(() {
|
setState(() {
|
||||||
showKey = true;
|
showKey = true;
|
||||||
|
|
Loading…
Reference in a new issue