configuration_cards 0.0.2 configuration_cards: ^0.0.2 copied to clipboard
A Flutter package to quickly create widgets to display basic application settings or similar.
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(MaterialApp(
title: 'Test Application ',
theme: ThemeData(
primarySwatch: Colors.red,
),
home: const Directionality(
textDirection: TextDirection.rtl, child: MyWidget()),
));
}
class MyWidget extends StatefulWidget {
const MyWidget({super.key});
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
@override
Widget build(BuildContext context) {
final List<ConfigurationCard> configurationCardList = [
ConfigurationCard(
title: 'title here',
child: Container(
height: MediaQuery.of(context).size.height * 0.37,
decoration: BoxDecoration(
color: Colors.amber,
borderRadius: BorderRadius.circular(18),
),
child: const Center(
child: Text('Child in first page(can be null)'),
),
),
),
ConfigurationCard(
title: 'title here',
child: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.15,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(18),
),
child: const Center(
child: Text('a widget, a world in flutter'),
),
),
SizedBox(
height: 12,
),
Container(
height: MediaQuery.of(context).size.height * 0.15,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(18),
),
child: const Center(
child: Text('Child in secound page(can be null)'),
),
),
],
),
),
const ConfigurationCard(
child: null,
title: 'other title for this card here',
),
];
return Scaffold(
body: ConfigSetting(
configurationCardList: configurationCardList,
onTapButton: (pageController, isLastPage) {
if (isLastPage) {
print('this is last Page ! :) ');
} else {
debugPrint('Clicked Me ------------- :)');
pageController.nextPage(
duration: const Duration(milliseconds: 200),
curve: Curves.bounceIn);
}
},
),
);
}
}