flutter_widget_catalogue 1.1.4+3
flutter_widget_catalogue: ^1.1.4+3 copied to clipboard
Create awesome apps very faster with Flutter's collection of visual, structural, platform, UI, and interactive widgets.
import 'package:example/Neumorphic/Module/widgets/widgets_home.dart';
import 'package:flutter/material.dart';
import 'Switch/switch.dart';
import 'Button/buttons.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Widgets',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
colorSchemeSeed: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Widgets'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final List<Map<String, dynamic>> items = [
{'title': 'Button Widgets', 'route': const Buttons()},
{'title': 'Neumorphic Widgets', 'route': const WidgetsHome()},
{'title': 'Switch Widgets', 'route': const MySwitch()},
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
widget.title,
style: const TextStyle(
fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
),
backgroundColor: Colors.blue.shade600,
elevation: 4,
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue.shade100, Colors.blue.shade50],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: ListView.builder(
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: listItem(
title: items[index]['title'],
widget: items[index]['route'],
),
);
},
),
),
),
);
}
Widget listItem({required String title, required Widget widget}) {
return Card(
elevation: 6,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: InkWell(
borderRadius: BorderRadius.circular(12),
onTap: () {
// ✅ Ensure navigation works correctly
Navigator.push(
context,
MaterialPageRoute(builder: (context) => widget),
);
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 18),
child: Center(
child: Text(
title,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.blue.shade700,
),
),
),
),
),
);
}
}
copied to clipboard