Skip to content

Commit b9d7f97

Browse files
author
sazardev
committed
Add WidgetDetailScreen for displaying detailed widget information with animations
1 parent de0c8a4 commit b9d7f97

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:get/get.dart';
3+
import 'package:animate_do/animate_do.dart';
4+
import 'package:widgets_in_flutter/code/code.screen.dart';
5+
6+
class WidgetDetailScreen extends StatelessWidget {
7+
const WidgetDetailScreen({super.key});
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
final Map<String, dynamic> arguments = Get.arguments;
12+
final String title = arguments['title'] ?? 'Widget Details';
13+
final String description =
14+
arguments['description'] ?? 'No description available';
15+
final String code = arguments['code'] ?? '';
16+
final Widget example = arguments['example'] ?? const SizedBox();
17+
final List<Map<String, dynamic>> properties = arguments['properties'] ?? [];
18+
19+
return Scaffold(
20+
appBar: AppBar(
21+
title: Text(title),
22+
actions: [
23+
IconButton(
24+
icon: const Icon(Icons.code),
25+
onPressed: () => Get.to(() => const CodeScreen(),
26+
arguments: {'code': code, 'title': '$title Code'}),
27+
),
28+
],
29+
),
30+
body: ListView(
31+
padding: const EdgeInsets.all(16),
32+
children: [
33+
FadeInDown(
34+
child: Text(
35+
title,
36+
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
37+
fontWeight: FontWeight.bold,
38+
),
39+
),
40+
),
41+
const SizedBox(height: 16),
42+
FadeInDown(
43+
delay: const Duration(milliseconds: 100),
44+
child: Text(
45+
description,
46+
style: Theme.of(context).textTheme.bodyLarge,
47+
),
48+
),
49+
const SizedBox(height: 24),
50+
FadeInDown(
51+
delay: const Duration(milliseconds: 200),
52+
child: Card(
53+
child: Padding(
54+
padding: const EdgeInsets.all(16),
55+
child: Column(
56+
crossAxisAlignment: CrossAxisAlignment.start,
57+
children: [
58+
Text(
59+
'Example',
60+
style: Theme.of(context).textTheme.titleMedium,
61+
),
62+
const Divider(),
63+
Center(child: example),
64+
],
65+
),
66+
),
67+
),
68+
),
69+
const SizedBox(height: 24),
70+
if (properties.isNotEmpty) ...[
71+
FadeInDown(
72+
delay: const Duration(milliseconds: 300),
73+
child: Text(
74+
'Properties',
75+
style: Theme.of(context).textTheme.titleLarge,
76+
),
77+
),
78+
const SizedBox(height: 8),
79+
...properties.asMap().entries.map((entry) {
80+
final index = entry.key;
81+
final property = entry.value;
82+
return FadeInDown(
83+
delay: Duration(milliseconds: 400 + (index * 100)),
84+
child: Card(
85+
margin: const EdgeInsets.symmetric(vertical: 8),
86+
child: ListTile(
87+
title: Text(property['name'] ?? ''),
88+
subtitle: Text(property['description'] ?? ''),
89+
trailing: property['type'] != null
90+
? Chip(label: Text(property['type']))
91+
: null,
92+
),
93+
),
94+
);
95+
}).toList(),
96+
],
97+
],
98+
),
99+
);
100+
}
101+
}

0 commit comments

Comments
 (0)