import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class CardCommonContact extends StatelessWidget { final image; final text; final subText; final type; const CardCommonContact( {@required this.image, @required this.text, @required this.subText, @required this.type}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return GestureDetector( onTap: () { navigateToSearch(context, this.type); }, child: Container( margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), decoration: BoxDecoration(boxShadow: [ BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) ], borderRadius: BorderRadius.circular(10), color: Colors.white), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(this.text, overflow: TextOverflow.clip, style: TextStyle( color: new Color(0xFFc5272d), letterSpacing: 1.0, fontSize: 20.0)), ), Container( margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), child: Text(this.subText, overflow: TextOverflow.clip, style: TextStyle( color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), ), Align( alignment: projectViewModel.isArabic? Alignment.bottomLeft:Alignment.bottomRight, child: Container( margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 8.0), child: Image.asset(this.image, width: 60.0, height: 60.0), ), ), ], ), ), ); } Future navigateToSearch(context, type) async { if (type == 0) { Navigator.push(context, FadePage(page: FindUsPage())); } else if (type == 1) { Navigator.push(context, FadePage(page: FeedbackHomePage())); } else if (type == 2) { //LiveChatPage Navigator.push(context, FadePage(page: LiveChatPage())); } } }