Line data Source code
1 : import 'package:flutter/material.dart';
2 :
3 : import '../../../actions.dart';
4 : import '../../../types.dart';
5 : import '../../redux/extensions/build_context_extensions.dart';
6 : import 'checked_circle_avatar.dart';
7 :
8 : class ProfileAvatar<T extends RedFireState> extends StatelessWidget {
9 : final String? photoURL;
10 : final void Function()? onPressed;
11 0 : const ProfileAvatar(this.photoURL, {this.onPressed, Key? key})
12 0 : : super(key: key);
13 :
14 0 : @override
15 : Widget build(BuildContext context) {
16 0 : final localPhotoURL = photoURL; // gimme that flow analysis
17 0 : return RawMaterialButton(
18 0 : onPressed: onPressed ??
19 0 : () => context.dispatch<T>(const PushPageAction(ProfilePageData())),
20 : elevation: 0.0,
21 : fillColor: Colors.white,
22 : padding: const EdgeInsets.all(5.0),
23 : shape: const CircleBorder(),
24 0 : child: CircleAvatar(
25 : radius: 17,
26 : backgroundColor: const Color(0xffFDCF09),
27 : child: (localPhotoURL == null)
28 : ? const Icon(Icons.account_circle_outlined)
29 0 : : CheckedCircleAvatar(radius: 15, url: localPhotoURL),
30 : ),
31 : );
32 : }
33 : }
|