2024-06-30 20:25:36 +02:00
|
|
|
// SPDX-FileCopyrightText: (C) 2024 Matyáš Caras
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
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 {
|
2024-01-08 15:38:31 +01:00
|
|
|
/// 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) {
|
2024-02-12 16:32:16 +01:00
|
|
|
if (Platform.isIOS || Platform.isMacOS) {
|
2023-09-08 11:50:21 +02:00
|
|
|
return createIosWidget(context);
|
2024-02-12 16:32:16 +01:00
|
|
|
} else {
|
|
|
|
return createAndroidWidget(context);
|
2023-09-08 11:50:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-29 21:39:54 +01:00
|
|
|
/// The widget that will be shown on Android
|
2023-09-08 11:50:21 +02:00
|
|
|
A createAndroidWidget(BuildContext context);
|
|
|
|
|
2023-12-29 21:39:54 +01:00
|
|
|
/// The widget that will be shown on iOS
|
2023-09-08 11:50:21 +02:00
|
|
|
I createIosWidget(BuildContext context);
|
|
|
|
}
|