Luis Aparicio пре 1 недеља
родитељ
комит
4e6443b1c4
3 измењених фајлова са 117 додато и 50 уклоњено
  1. 66
    50
      lib/custom_info_card.dart
  2. 49
    0
      lib/detail_page.dart
  3. 2
    0
      lib/main.dart

+ 66
- 50
lib/custom_info_card.dart Прегледај датотеку

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
+import 'detail_page.dart'; // Importa la nueva pantalla
2
 
3
 
3
 class CustomInfoCard extends StatelessWidget {
4
 class CustomInfoCard extends StatelessWidget {
4
   final String imagePath;
5
   final String imagePath;
5
   final String title;
6
   final String title;
6
   final String subtitle;
7
   final String subtitle;
8
+  final String texto;
7
 
9
 
8
   const CustomInfoCard({
10
   const CustomInfoCard({
9
     super.key,
11
     super.key,
10
     required this.imagePath,
12
     required this.imagePath,
11
     required this.title,
13
     required this.title,
12
     required this.subtitle,
14
     required this.subtitle,
15
+    required this.texto,
13
   });
16
   });
14
 
17
 
15
   @override
18
   @override
16
   Widget build(BuildContext context) {
19
   Widget build(BuildContext context) {
17
-    return SizedBox(
18
-      width: double.infinity, // Takes full width of parent
19
-      height: 130, // Fixed height, adjust as needed
20
-      child: Card(
21
-        margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
22
-        shape: RoundedRectangleBorder(
23
-          borderRadius: BorderRadius.circular(30),
24
-        ),
25
-        color: const Color.fromARGB(255, 254, 242, 221),
26
-        child: Padding(
27
-          padding: const EdgeInsets.only(right: 8),
28
-          child: Row(
29
-            children: [
30
-              Container(
31
-                width: 90, // Fixed width to match the height (110 - 16 * 2)
32
-                height: 90,
33
-                decoration: BoxDecoration(
34
-                  color: Colors.white,
35
-                  borderRadius: BorderRadius.circular(36),
36
-                ),
37
-                child: ClipRRect(
38
-                  borderRadius: BorderRadius.circular(36),
39
-                  child: Image.asset(
40
-                    imagePath,
41
-                    fit: BoxFit.cover,
42
-                    width: 90,
43
-                    height: 90,
20
+    return GestureDetector(
21
+      onTap: () {
22
+        Navigator.push(
23
+          context,
24
+          MaterialPageRoute(
25
+            builder: (context) => DetailPage(
26
+              title: title,
27
+              texto: texto,
28
+            ),
29
+          ),
30
+        );
31
+      },
32
+      child: SizedBox(
33
+        width: double.infinity,
34
+        height: 130,
35
+        child: Card(
36
+          margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
37
+          shape: RoundedRectangleBorder(
38
+            borderRadius: BorderRadius.circular(30),
39
+          ),
40
+          color: const Color.fromARGB(255, 254, 242, 221),
41
+          child: Padding(
42
+            padding: const EdgeInsets.only(right: 8),
43
+            child: Row(
44
+              children: [
45
+                Container(
46
+                  width: 90,
47
+                  height: 90,
48
+                  decoration: BoxDecoration(
49
+                    color: Colors.white,
50
+                    borderRadius: BorderRadius.circular(36),
51
+                  ),
52
+                  child: ClipRRect(
53
+                    borderRadius: BorderRadius.circular(36),
54
+                    child: Image.asset(
55
+                      imagePath,
56
+                      fit: BoxFit.cover,
57
+                      width: 90,
58
+                      height: 90,
59
+                    ),
44
                   ),
60
                   ),
45
                 ),
61
                 ),
46
-              ),
47
-              const SizedBox(width: 16),
48
-              Expanded(
49
-                child: Column(
50
-                  mainAxisAlignment: MainAxisAlignment.center,
51
-                  crossAxisAlignment: CrossAxisAlignment.start,
52
-                  children: [
53
-                    Text(
54
-                      title,
55
-                      style: const TextStyle(
56
-                        fontSize: 16,
57
-                        fontWeight: FontWeight.bold,
62
+                const SizedBox(width: 16),
63
+                Expanded(
64
+                  child: Column(
65
+                    mainAxisAlignment: MainAxisAlignment.center,
66
+                    crossAxisAlignment: CrossAxisAlignment.start,
67
+                    children: [
68
+                      Text(
69
+                        title,
70
+                        style: const TextStyle(
71
+                          fontSize: 16,
72
+                          fontWeight: FontWeight.bold,
73
+                        ),
58
                       ),
74
                       ),
59
-                    ),
60
-                    const SizedBox(height: 4),
61
-                    Text(
62
-                      subtitle,
63
-                      style: TextStyle(
64
-                        fontSize: 14,
65
-                        color: Colors.grey[600],
75
+                      const SizedBox(height: 4),
76
+                      Text(
77
+                        subtitle,
78
+                        style: TextStyle(
79
+                          fontSize: 14,
80
+                          color: Colors.grey[600],
81
+                        ),
66
                       ),
82
                       ),
67
-                    ),
68
-                  ],
83
+                    ],
84
+                  ),
69
                 ),
85
                 ),
70
-              ),
71
-            ],
86
+              ],
87
+            ),
72
           ),
88
           ),
73
         ),
89
         ),
74
       ),
90
       ),

+ 49
- 0
lib/detail_page.dart Прегледај датотеку

1
+import 'package:flutter/material.dart';
2
+
3
+class DetailPage extends StatelessWidget {
4
+  final String title;
5
+  final String texto;
6
+
7
+  const DetailPage({
8
+    super.key,
9
+    required this.title,
10
+    required this.texto,
11
+  });
12
+
13
+  @override
14
+  Widget build(BuildContext context) {
15
+    return Scaffold(
16
+      appBar: AppBar(
17
+        flexibleSpace: Padding(
18
+          padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
19
+          child: Image.asset(
20
+            'assets/header_image.png',
21
+            fit: BoxFit.cover,
22
+          ),
23
+        ),
24
+        toolbarHeight: MediaQuery.of(context).size.height * 0.19,
25
+      ),
26
+      body: SingleChildScrollView( // Permite el desplazamiento
27
+        child: Padding(
28
+          padding: const EdgeInsets.all(16.0),
29
+          child: Column(
30
+            crossAxisAlignment: CrossAxisAlignment.center,
31
+            children: [
32
+              Text(
33
+                title,
34
+                style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
35
+                textAlign: TextAlign.center,
36
+              ),
37
+              const SizedBox(height: 8),
38
+              Text(
39
+                texto,
40
+                style: const TextStyle(fontSize: 18, color: Colors.black),
41
+                textAlign: TextAlign.justify,
42
+              ),
43
+            ],
44
+          ),
45
+        ),
46
+      ),
47
+    );
48
+  }
49
+}

+ 2
- 0
lib/main.dart Прегледај датотеку

97
                   'image': entry['gsx\$image']?['\$t'] ?? '',
97
                   'image': entry['gsx\$image']?['\$t'] ?? '',
98
                   'title': entry['gsx\$title']?['\$t'] ?? '',
98
                   'title': entry['gsx\$title']?['\$t'] ?? '',
99
                   'subtitle': entry['gsx\$subtitle']?['\$t'] ?? '',
99
                   'subtitle': entry['gsx\$subtitle']?['\$t'] ?? '',
100
+                  'texto': entry['gsx\$texto']?['\$t'] ?? '',
100
                 };
101
                 };
101
                 newData.add(card);
102
                 newData.add(card);
102
               }
103
               }
211
                         imagePath: "assets/icons/${card['image']}",
212
                         imagePath: "assets/icons/${card['image']}",
212
                         title: card['title'],
213
                         title: card['title'],
213
                         subtitle: card['subtitle'],
214
                         subtitle: card['subtitle'],
215
+                        texto: card['texto'],
214
                       );
216
                       );
215
                     },
217
                     },
216
                   ),
218
                   ),