Grain flutter app
1import 'package:flutter/material.dart';
2import 'package:grain/models/photo_exif.dart';
3
4class PhotoExifDialog extends StatelessWidget {
5 final PhotoExif exif;
6 const PhotoExifDialog({super.key, required this.exif});
7
8 @override
9 Widget build(BuildContext context) {
10 return Dialog(
11 backgroundColor: Colors.black45,
12 child: Padding(
13 padding: const EdgeInsets.all(20),
14 child: SingleChildScrollView(
15 child: Column(
16 crossAxisAlignment: CrossAxisAlignment.start,
17 children: [
18 Text(
19 'Camera Settings',
20 style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold),
21 ),
22 const SizedBox(height: 16),
23 if (exif.make != null)
24 RichText(
25 text: TextSpan(
26 children: [
27 TextSpan(
28 text: 'Make: ',
29 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
30 ),
31 TextSpan(
32 text: exif.make!,
33 style: TextStyle(color: Colors.white),
34 ),
35 ],
36 ),
37 ),
38 if (exif.model != null)
39 RichText(
40 text: TextSpan(
41 children: [
42 TextSpan(
43 text: 'Model: ',
44 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
45 ),
46 TextSpan(
47 text: exif.model!,
48 style: TextStyle(color: Colors.white),
49 ),
50 ],
51 ),
52 ),
53 if (exif.lensMake != null)
54 RichText(
55 text: TextSpan(
56 children: [
57 TextSpan(
58 text: 'Lens Make: ',
59 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
60 ),
61 TextSpan(
62 text: exif.lensMake!,
63 style: TextStyle(color: Colors.white),
64 ),
65 ],
66 ),
67 ),
68 if (exif.lensModel != null)
69 RichText(
70 text: TextSpan(
71 children: [
72 TextSpan(
73 text: 'Lens Model: ',
74 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
75 ),
76 TextSpan(
77 text: exif.lensModel!,
78 style: TextStyle(color: Colors.white),
79 ),
80 ],
81 ),
82 ),
83 if (exif.fNumber != null)
84 RichText(
85 text: TextSpan(
86 children: [
87 TextSpan(
88 text: 'F Number: ',
89 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
90 ),
91 TextSpan(
92 text: exif.fNumber!,
93 style: TextStyle(color: Colors.white),
94 ),
95 ],
96 ),
97 ),
98 if (exif.focalLengthIn35mmFormat != null)
99 RichText(
100 text: TextSpan(
101 children: [
102 TextSpan(
103 text: 'Focal Length (35mm): ',
104 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
105 ),
106 TextSpan(
107 text: exif.focalLengthIn35mmFormat!,
108 style: TextStyle(color: Colors.white),
109 ),
110 ],
111 ),
112 ),
113 if (exif.exposureTime != null)
114 RichText(
115 text: TextSpan(
116 children: [
117 TextSpan(
118 text: 'Exposure Time: ',
119 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
120 ),
121 TextSpan(
122 text: exif.exposureTime!,
123 style: TextStyle(color: Colors.white),
124 ),
125 ],
126 ),
127 ),
128 if (exif.iSO != null)
129 RichText(
130 text: TextSpan(
131 children: [
132 TextSpan(
133 text: 'ISO: ',
134 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
135 ),
136 TextSpan(
137 text: exif.iSO.toString(),
138 style: TextStyle(color: Colors.white),
139 ),
140 ],
141 ),
142 ),
143 if (exif.flash != null)
144 RichText(
145 text: TextSpan(
146 children: [
147 TextSpan(
148 text: 'Flash: ',
149 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
150 ),
151 TextSpan(
152 text: exif.flash!,
153 style: TextStyle(color: Colors.white),
154 ),
155 ],
156 ),
157 ),
158 if (exif.dateTimeOriginal != null)
159 RichText(
160 text: TextSpan(
161 children: [
162 TextSpan(
163 text: 'DateTime Original: ',
164 style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
165 ),
166 TextSpan(
167 text: exif.dateTimeOriginal!,
168 style: TextStyle(color: Colors.white),
169 ),
170 ],
171 ),
172 ),
173 const SizedBox(height: 20),
174 Align(
175 alignment: Alignment.centerRight,
176 child: TextButton(
177 onPressed: () => Navigator.of(context).pop(),
178 child: Text('Close', style: TextStyle(color: Colors.white)),
179 ),
180 ),
181 ],
182 ),
183 ),
184 ),
185 );
186 }
187}