Skip to content

Commit

Permalink
#17: Update font colors and unify ListTile components
Browse files Browse the repository at this point in the history
  • Loading branch information
hjtappe committed Dec 3, 2024
1 parent b57698e commit c613286
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 102 deletions.
51 changes: 30 additions & 21 deletions lib/components/room_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ class RoomListTile extends StatelessWidget {

@override
Widget build(BuildContext context) {
String imageUrl = item.imageUrl;
return ListTile(
leading: item.imageUrl.startsWith("http") ?
leading: imageUrl.startsWith("http") ?
CircleAvatar(
radius: 50.0,
child: SizedBox(
width: 100.0, // Diameter of CircleAvatar
height: 100.0,
child: CachedNetworkImage(
imageUrl: item.imageUrl,
placeholder: (context, url) => FittedBox(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => FittedBox(
child: Icon(Icons.error),
),
imageUrl: imageUrl,
placeholder: (context, url) =>
FittedBox(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) =>
FittedBox(
child: Icon(Icons.error),
),
)
)
) :
Expand All @@ -37,28 +40,33 @@ class RoomListTile extends StatelessWidget {
),
title: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.name,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
),
style: Theme
.of(context)
.textTheme
.titleMedium,
),
],
),
softWrap: false,
),
subtitle: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.details,
style: const TextStyle(
fontSize: 16,
),
style: Theme
.of(context)
.textTheme
.bodyMedium,
),
],
),
Expand All @@ -68,10 +76,11 @@ class RoomListTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Theme(
data: Theme.of(context),
child: RoomDetailsPage(item: item),
),
builder: (context) =>
Theme(
data: Theme.of(context),
child: RoomDetailsPage(item: item),
),
),
);
},
Expand Down
63 changes: 36 additions & 27 deletions lib/components/speaker_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,52 +13,60 @@ class SpeakerListTile extends StatelessWidget {

@override
Widget build(BuildContext context) {
String imageUrl = item.imageUrl;
return ListTile(
leading: item.imageUrl.startsWith("http") ?
leading: imageUrl.startsWith("http") ?
CircleAvatar(
radius: 50.0,
child: SizedBox(
width: 100.0, // Diameter of CircleAvatar
height: 100.0,
child: CachedNetworkImage(
imageUrl: item.imageUrl,
placeholder: (context, url) => FittedBox(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => FittedBox(
child: Icon(Icons.error),
),
radius: 50.0,
child: SizedBox(
width: 100.0, // Diameter of CircleAvatar
height: 100.0,
child: CachedNetworkImage(
imageUrl: imageUrl,
placeholder: (context, url) =>
FittedBox(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) =>
FittedBox(
child: Icon(Icons.error),
),
)
)
)
) :
const SizedBox(
height: 100,
width: 100,
),
title: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.name,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
),
style: Theme
.of(context)
.textTheme
.titleMedium,
),
],
),
softWrap: false,
),
subtitle: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.details,
style: const TextStyle(
fontSize: 16,
),
style: Theme
.of(context)
.textTheme
.bodyMedium,
),
],
),
Expand All @@ -68,10 +76,11 @@ class SpeakerListTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Theme(
data: Theme.of(context),
child: SpeakerDetailsPage(item: item),
),
builder: (context) =>
Theme(
data: Theme.of(context),
child: SpeakerDetailsPage(item: item),
),
),
);
},
Expand Down
51 changes: 30 additions & 21 deletions lib/components/track_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ class TrackListTile extends StatelessWidget {

@override
Widget build(BuildContext context) {
String imageUrl = item.imageUrl;
return ListTile(
leading: item.imageUrl.startsWith("http") ?
leading: imageUrl.startsWith("http") ?
CircleAvatar(
radius: 50.0,
child: SizedBox(
width: 100.0, // Diameter of CircleAvatar
height: 100.0,
child: CachedNetworkImage(
imageUrl: item.imageUrl,
placeholder: (context, url) => FittedBox(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => FittedBox(
child: Icon(Icons.error),
),
imageUrl: imageUrl,
placeholder: (context, url) =>
FittedBox(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) =>
FittedBox(
child: Icon(Icons.error),
),
)
)
) :
Expand All @@ -37,28 +40,33 @@ class TrackListTile extends StatelessWidget {
),
title: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.name,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
),
style: Theme
.of(context)
.textTheme
.titleMedium,
),
],
),
softWrap: false,
),
subtitle: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.details,
style: const TextStyle(
fontSize: 16,
),
style: Theme
.of(context)
.textTheme
.bodyMedium,
),
],
),
Expand All @@ -68,10 +76,11 @@ class TrackListTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Theme(
data: Theme.of(context),
child: TrackDetailsPage(item: item),
),
builder: (context) =>
Theme(
data: Theme.of(context),
child: TrackDetailsPage(item: item),
),
),
);
},
Expand Down
68 changes: 38 additions & 30 deletions lib/components/travel_details_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,62 @@ class TravelDetailsListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
bool isValidEmoji = (item.emoji != null && item.emoji!.isNotEmpty);
bool isValidImageUrl = item.imageUrl.startsWith("http");
String imageUrl = item.imageUrl;
bool isValidImageUrl = imageUrl.startsWith("http");
return ListTile(
leading: isValidEmoji ?
Text(item.emoji ?? '',
style: TextStyle(
fontSize: 24,
),
) :
isValidImageUrl ?
CachedNetworkImage(
imageUrl: item.imageUrl,
imageBuilder: (context, imageProvider) => CircleAvatar(
Text(item.emoji ?? '',
style: TextStyle(
fontSize: 24,
),
) :
isValidImageUrl ?
CachedNetworkImage(
imageUrl: imageUrl,
imageBuilder: (context, imageProvider) =>
CircleAvatar(
backgroundImage: imageProvider,
radius: 50,
),
placeholder: (context, url) => const CircularProgressIndicator(),
errorWidget: (context, url, error) => const Icon(Icons.error),
) :
const SizedBox(
height: 100,
width: 100,
),
placeholder: (context, url) => const CircularProgressIndicator(),
errorWidget: (context, url, error) => const Icon(Icons.error),
) :
const SizedBox(
height: 100,
width: 100,
),
title: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: item.name,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
),
style: Theme
.of(context)
.textTheme
.titleMedium,
),
],
),
softWrap: false,
),
subtitle: RichText(
text: TextSpan(
style: DefaultTextStyle.of(context).style,
style: DefaultTextStyle
.of(context)
.style,
children: <TextSpan>[
TextSpan(
text: TextFunctions.cutTextToWords(
text: item.details,
length: 20,
),
style: const TextStyle(
fontSize: 16,
),
style: Theme
.of(context)
.textTheme
.bodyMedium,
),
],
),
Expand All @@ -73,10 +80,11 @@ class TravelDetailsListTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Theme(
data: Theme.of(context),
child: TravelDetailsPage(item: item),
),
builder: (context) =>
Theme(
data: Theme.of(context),
child: TravelDetailsPage(item: item),
),
),
);
},
Expand Down
Loading

0 comments on commit c613286

Please sign in to comment.