import 'package:flutter/material.dart'; import 'package:teso/Classes/TesoShop.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:page_transition/page_transition.dart'; import 'Business/BusinessProfile.dart'; buildShopDetails(BuildContext context, TesoShop shop, Function navigate) { return Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.width, padding: EdgeInsets.all(20), child: SingleChildScrollView( scrollDirection: Axis.vertical, child: new Column( children: [ new Container( width: double.infinity, margin: EdgeInsets.symmetric(vertical: 2), child: Text( shop.shopName, style: TextStyle( fontSize: 25.0, fontWeight: FontWeight.w900, ), )), Container( width: double.infinity, child: new Text( shop.categoryShop, ), ), Container( width: double.infinity, child: new Text( shop.shopAddress, ), ), new InkWell( onTap: () async { if (await canLaunch("tel:" + shop.shopPhone)) { await launch("tel:" + shop.shopPhone); } else { throw 'call not possible'; } }, child: Container( width: double.infinity, padding: EdgeInsets.all(5), child: Center( child: new Wrap( children: [ Container( child: Icon( Icons.call, color: Colors.blue, ), ), Container( child: Text( shop.shopPhone, style: TextStyle( color: Colors.blue, ), ), ), ], ), ), ), ), Container( height: 50, width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 10), margin: EdgeInsets.all(7), decoration: BoxDecoration( color: Theme.of(context).backgroundColor, borderRadius: BorderRadius.all(Radius.circular(20.0)), border: Border.all( color: Theme.of(context).colorScheme.secondary, )), child: InkWell( onTap: () => Navigator.push( context, PageTransition( child: BusinessProfile( shop: shop, ), type: PageTransitionType.bottomToTop), ), child: Container( child: ListTile( leading: Icon( Icons.shop, size: 19, ), title: Text( "View Business Profile", style: TextStyle( color: Theme.of(context).colorScheme.secondary, fontSize: 15), ), ), ), ), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 05.0), child: Divider(), ), Container( width: double.infinity, child: new Text( shop.shopDescription != null ? shop.shopDescription.toLowerCase() != "null" ? shop.shopDescription : "Registered Teso Business" : "Registered Teso Business", ), ), SizedBox( height: 15, ), new Container( width: MediaQuery.of(context).size.width, child: ElevatedButton( style: ElevatedButton.styleFrom( primary: Theme.of(context).colorScheme.secondary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(25.0), ), ), ), onPressed: () async { Navigator.pop(context); await navigate(shop); }, child: Text( "Navigate to " + shop.shopName, style: TextStyle( color: Colors.white, ), ), ), ), ], ), ), ); }