frosty/lib/widgets/profile_picture.dart
Tommy Chow f68de827cd
Refresh themes and styling (#394)
* consolidate themes

* update and tweak styles, add border styling

* add borders between video and chat

* tweak heights

* improve reply threads
- taller new design
- can now tap parent's reply
- fix crash when tapping self

* tweak border colors

* tweak theme

* tweak theme

* tweak theme

* add accent color picker in settings

* overhaul colors and styles

* remove print

* add divider to chat user modal and revert height

* increase deleted message opacity

* revert highlight color

* tweak color

* tweak colors

* tweak padding

* tweak padding

* tweak placeholder color

* revert input fill color

* use error color
2024-09-06 21:43:27 -07:00

48 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:frosty/apis/twitch_api.dart';
import 'package:frosty/models/user.dart';
import 'package:frosty/screens/settings/stores/auth_store.dart';
import 'package:frosty/widgets/cached_image.dart';
import 'package:provider/provider.dart';
class ProfilePicture extends StatelessWidget {
final String userLogin;
final double radius;
const ProfilePicture({
super.key,
required this.userLogin,
this.radius = 20,
});
@override
Widget build(BuildContext context) {
final diameter = radius * 2;
final placeholderColor = Theme.of(context).colorScheme.surfaceContainer;
return ClipOval(
child: FutureBuilder(
future: context.read<TwitchApi>().getUser(
userLogin: userLogin,
headers: context.read<AuthStore>().headersTwitch,
),
builder: (context, AsyncSnapshot<UserTwitch> snapshot) {
return snapshot.hasData
? FrostyCachedNetworkImage(
width: diameter,
height: diameter,
imageUrl: snapshot.data!.profileImageUrl,
placeholder: (context, url) =>
ColoredBox(color: placeholderColor),
)
: Container(
color: placeholderColor,
width: diameter,
height: diameter,
);
},
),
);
}
}