prasule/lib/pw/platformwidget.dart

26 lines
728 B
Dart
Raw Normal View History

2023-09-08 11:50:21 +02:00
import 'dart:io';
import 'package:flutter/material.dart';
/// Abstract class used to create widgets for the respective platform UI library
abstract class PlatformWidget<A extends Widget, I extends Widget>
extends StatelessWidget {
/// Abstract class used to create widgets for the respective platform UI library
2023-09-08 11:50:21 +02:00
const PlatformWidget({super.key});
@override
Widget build(BuildContext context) {
if (Platform.isAndroid) {
return createAndroidWidget(context);
} else {
return createIosWidget(context);
}
}
/// The widget that will be shown on Android
2023-09-08 11:50:21 +02:00
A createAndroidWidget(BuildContext context);
/// The widget that will be shown on iOS
2023-09-08 11:50:21 +02:00
I createIosWidget(BuildContext context);
}