Files
universal_ble/example/lib/widgets/platform_button.dart
T
Rohit Sangwan 531b6139c4 Improve example app (#2)
* Improve example app

* Accept list of hex values in write value field

* Minor fix

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2024-01-25 18:55:49 +01:00

35 lines
897 B
Dart

import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class PlatformButton extends StatelessWidget {
final String text;
final Function()? onPressed;
final bool enabled;
const PlatformButton({
required this.text,
required this.onPressed,
this.enabled = true,
super.key,
});
@override
Widget build(BuildContext context) {
return (!kIsWeb && (Platform.isMacOS || Platform.isIOS))
? CupertinoButton.filled(
onPressed: enabled ? onPressed : null,
// color: Colors.blue,
padding: const EdgeInsets.symmetric(horizontal: 10),
disabledColor: Colors.grey,
child: Text(text),
)
: ElevatedButton(
onPressed: enabled ? onPressed : null,
child: Text(text),
);
}
}