part of 'index.dart'; interface class Category extends Entity { final Color color; final String title; Category({ required this.color, required this.title, }); } interface class Document extends Entity { final String title; final String description; final Category category; final String to; final String from; final String createdAt; final String updatedAt; Document({ required this.createdAt, required this.updatedAt, required this.category, required this.to, required this.from, required this.title, required this.description, }); } class DocumentItem extends StatelessWidget { final Document document; const DocumentItem({Key? key, required this.document}) : super(key: key); Tooltip _buildTooltip(String text, Color color, BuildContext context, BoxConstraints constraints) { final Color textColor = FlutterFlowTheme.of(context).info; final double boxHeight = MediaQuery.of(context).size.height * 0.02; final double boxWidth = MediaQuery.of(context).size.height * 0.1; return Tooltip( message: text, child: Container( width: boxWidth, height: boxHeight, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10), ), child: Center( child: AutoText( text, overflow: TextOverflow.ellipsis, style: TextStyle( color: textColor, fontWeight: FontWeight.bold, ), ), ), ), ); } @override Widget build(BuildContext context) { final Color primaryText = FlutterFlowTheme.of(context).primaryText; final Color primaryColor = FlutterFlowTheme.of(context).primary; final TextStyle textStyleMajor = TextStyle( color: primaryText, fontWeight: FontWeight.bold, ); final TextStyle textStyleMinor = TextStyle( color: primaryText, fontWeight: FontWeight.normal, fontStyle: FontStyle.italic, ); return Padding( padding: const EdgeInsets.all(8), child: LayoutBuilder( builder: (context, constraints) { final double boxHeight = constraints.maxHeight > 350 ? MediaQuery.of(context).size.height * 0.07 : MediaQuery.of(context).size.height * 2; return InkWell( onTap: () => print('Click'), enableFeedback: true, overlayColor: MaterialStateProperty.all(primaryColor), borderRadius: BorderRadius.circular(10), child: SizedBox( height: boxHeight, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ // const SizedBox(width: 10), Icon(Icons.description, color: document.category.color), // const SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: document.title, child: AutoText( document.title, style: textStyleMajor, overflow: TextOverflow.ellipsis, ), ), AutoText( document.updatedAt, style: textStyleMinor, overflow: TextOverflow.ellipsis, ), ], ), ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [ _buildTooltip( document.category.title, document.category.color, context, constraints, ), ], ), ), // const SizedBox(width: 10), Center( child: Icon( Icons.arrow_right, color: primaryText, ), ), ], ), ), ); }, ), ); } }