Skip to content

Commit d0a941f

Browse files
committed
ggwp
1 parent 2ebd209 commit d0a941f

6 files changed

Lines changed: 255 additions & 242 deletions

File tree

lib/views/create_post_screen.dart

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:io';
22
import 'package:flutter/material.dart';
3+
import 'package:cached_network_image/cached_network_image.dart';
34
import 'package:flutter_riverpod/flutter_riverpod.dart';
45
import 'package:go_router/go_router.dart';
56
import '../models/pet_model.dart';
@@ -15,10 +16,10 @@ class CreatePostScreen extends ConsumerStatefulWidget {
1516
const CreatePostScreen({super.key, this.initialPetId});
1617

1718
@override
18-
ConsumerState<CreatePostScreen> createState() => _CreatePostScreenState();
19+
ConsumerState<CreatePostScreen> createState() => CreatePostScreenState();
1920
}
2021

21-
class _CreatePostScreenState extends ConsumerState<CreatePostScreen> {
22+
class CreatePostScreenState extends ConsumerState<CreatePostScreen> {
2223
String? selectedPetId;
2324
File? _selectedFile;
2425
PostMediaType _selectedMediaType = PostMediaType.image;
@@ -55,7 +56,7 @@ class _CreatePostScreenState extends ConsumerState<CreatePostScreen> {
5556
context: context,
5657
isScrollControlled: true,
5758
backgroundColor: Colors.transparent,
58-
builder: (_) => _LocationSheetContent(initialLocation: _location),
59+
builder: (_) => LocationSheetContent(initialLocation: _location),
5960
);
6061

6162
if (!mounted || result == null) return;
@@ -83,7 +84,7 @@ class _CreatePostScreenState extends ConsumerState<CreatePostScreen> {
8384
builder: (_, setSheetState) {
8485
return Padding(
8586
padding: EdgeInsets.only(bottom: bottomInset),
86-
child: _ComposerSheet(
87+
child: ComposerSheet(
8788
title: 'Tag Other Pets',
8889
subtitle: 'Mention pets who are part of this post.',
8990
child: SizedBox(
@@ -104,7 +105,7 @@ class _CreatePostScreenState extends ConsumerState<CreatePostScreen> {
104105
contentPadding: EdgeInsets.zero,
105106
secondary: CircleAvatar(
106107
backgroundImage: pet.profileImageUrl.isNotEmpty
107-
? NetworkImage(pet.profileImageUrl)
108+
? CachedNetworkImageProvider(pet.profileImageUrl)
108109
: null,
109110
backgroundColor: colorScheme.surfaceContainer,
110111
child: pet.profileImageUrl.isEmpty
@@ -556,12 +557,12 @@ class _CloseComposerButton extends StatelessWidget {
556557
}
557558
}
558559

559-
class _ComposerSheet extends StatelessWidget {
560+
class ComposerSheet extends StatelessWidget {
560561
final String title;
561562
final String subtitle;
562563
final Widget child;
563564

564-
const _ComposerSheet({
565+
const ComposerSheet({super.key,
565566
required this.title,
566567
required this.subtitle,
567568
required this.child,
@@ -1256,7 +1257,7 @@ class _AuthorAvatar extends StatelessWidget {
12561257
radius: 14,
12571258
backgroundColor: colorScheme.surfaceContainerHighest,
12581259
backgroundImage: pet.profileImageUrl.isNotEmpty
1259-
? NetworkImage(pet.profileImageUrl)
1260+
? CachedNetworkImageProvider(pet.profileImageUrl)
12601261
: null,
12611262
child: pet.profileImageUrl.isEmpty
12621263
? Text(
@@ -1288,15 +1289,15 @@ class _AuthorAvatar extends StatelessWidget {
12881289
}
12891290
}
12901291

1291-
class _LocationSheetContent extends StatefulWidget {
1292+
class LocationSheetContent extends StatefulWidget {
12921293
final String initialLocation;
1293-
const _LocationSheetContent({required this.initialLocation});
1294+
const LocationSheetContent({super.key, required this.initialLocation});
12941295

12951296
@override
1296-
State<_LocationSheetContent> createState() => _LocationSheetContentState();
1297+
State<LocationSheetContent> createState() => LocationSheetContentState();
12971298
}
12981299

1299-
class _LocationSheetContentState extends State<_LocationSheetContent> {
1300+
class LocationSheetContentState extends State<LocationSheetContent> {
13001301
late final TextEditingController _controller;
13011302

13021303
@override
@@ -1317,7 +1318,7 @@ class _LocationSheetContentState extends State<_LocationSheetContent> {
13171318
final bottomInset = MediaQuery.viewInsetsOf(context).bottom;
13181319
return Padding(
13191320
padding: EdgeInsets.only(bottom: bottomInset),
1320-
child: _ComposerSheet(
1321+
child: ComposerSheet(
13211322
title: 'Add Location',
13221323
subtitle: 'Add where this moment happened.',
13231324
child: Column(

0 commit comments

Comments
 (0)