import 'package:flutter/material.dart'; import 'image_placeholder.dart'; class CardItem extends StatelessWidget { CardItem({ required this.title, required this.subTitle, this.isAmount = false, this.onTap, this.logoUrl, }); final VoidCallback? onTap; final String title; final String subTitle; final String? logoUrl; final bool isAmount; @override Widget build(BuildContext context) { return Theme( data: ThemeData( splashColor: Colors.transparent, highlightColor: Colors.transparent, ), child: InkWell( onTap: onTap, child: Container( decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(10), ), child: Row( children: [ if (logoUrl != null) AspectRatio( aspectRatio: 1.8, child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(10)), child: Image.network( logoUrl!, fit: BoxFit.cover, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) { if (loadingProgress == null) return child; return Center(child: CircularProgressIndicator()); }, errorBuilder: (context, error, stackTrace) => CakePayCardImagePlaceholder(), ), ), ), Expanded( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(title, maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context) .textTheme .bodyMedium! .copyWith(fontSize: 18, fontWeight: FontWeight.w700)), Text(subTitle, maxLines: 2, overflow: TextOverflow.ellipsis, style: Theme.of(context) .textTheme .bodySmall! .copyWith(fontSize: 10, fontWeight: FontWeight.w700)), ], ), ), ), ], ), ), ), ); } }