adaptive_widgets_flutter 0.0.2
adaptive_widgets_flutter: ^0.0.2 copied to clipboard
A Flutter package for supporting adaptive widgets for iOS and Android platform.
example/lib/main.dart
import 'package:adaptive_widgets_flutter/adaptive_widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Adaptive Widgets',
home: Home(),
);
}
}
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: getAppBar(),
body: AdaptiveWidgets.buildRefreshableScrollView(
context,
slivers: [
SliverToBoxAdapter(
child: CupertinoButton(
onPressed: () async {
await AdaptiveWidgets.showDatePicker(context);
},
child: const Text('Show Date Picker'),
),
),
SliverToBoxAdapter(
child: CupertinoButton(
onPressed: () async {
await AdaptiveWidgets.(context, title, content, actionButtons)
},
child: const Text('Show Time Picker'),
),
)
],
),
);
}
}
// * ------------------------ WidgetFactories ------------------------
extension _WidgetFactories on Home {
AppBar getAppBar() {
return AppBar(
title: const Text('Adaptive Widgets'),
);
}
}