Files
Bryce Cole b0d917b05a New Example - Platform Adaptive Example (#121)
* Adding Platform Adaptive Example

* Adding screenshots
2022-10-22 20:13:07 +02:00

22 lines
575 B
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
abstract class PlatformAdaptiveWidget extends StatelessWidget {
const PlatformAdaptiveWidget({super.key, this.forcePlatform});
final TargetPlatform? forcePlatform;
@override
Widget build(BuildContext context) {
switch (forcePlatform ?? defaultTargetPlatform) {
case TargetPlatform.iOS:
return buildIOS(context);
default:
return buildAndroid(context);
}
}
Widget buildIOS(BuildContext context);
Widget buildAndroid(BuildContext context);
}