import 'package:flutter/material.dart'; import 'package:fooddeliveryapp/constants.dart'; import 'package:fooddeliveryapp/model/product.dart'; class ProductTitleWithImage extends StatelessWidget { const ProductTitleWithImage({ Key key, @required this.product, }) : super(key: key); final Product product; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: kDefaultPaddin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "最最美味的菜品来自海底捞", style: TextStyle(color: Colors.white), ), Text( product.title, style: Theme.of(context) .textTheme .headline4 .copyWith(color: Colors.white, fontWeight: FontWeight.bold), ), SizedBox(height: kDefaultPaddin), Row( children: [ RichText( text: TextSpan( children: [ TextSpan(text: "价格\n"), TextSpan( text: "${product.price}元", style: Theme.of(context).textTheme.headline4.copyWith( color: Colors.white, fontWeight: FontWeight.bold), ), ], ), ), SizedBox(width: kDefaultPaddin), Expanded( child: Hero( tag: "${product.id}", child: Image.asset( product.image, fit: BoxFit.fill, ), ), ) ], ) ], ), ); } }