forked from yaso_meth/mih-project
add rating to business info card
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:custom_rating_bar/custom_rating_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||
@@ -9,12 +10,14 @@ class MihBusinessCard extends StatefulWidget {
|
||||
final String email;
|
||||
final String gpsLocation;
|
||||
final String? website;
|
||||
final double rating;
|
||||
const MihBusinessCard({
|
||||
super.key,
|
||||
required this.businessName,
|
||||
required this.cellNumber,
|
||||
required this.email,
|
||||
required this.gpsLocation,
|
||||
required this.rating,
|
||||
this.website,
|
||||
});
|
||||
|
||||
@@ -336,6 +339,34 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
RatingBar.readOnly(
|
||||
size: 50,
|
||||
alignment: Alignment.center,
|
||||
filledIcon: Icons.star,
|
||||
emptyIcon: Icons.star_border,
|
||||
halfFilledIcon: Icons.star_half,
|
||||
filledColor:
|
||||
MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
||||
emptyColor: MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
||||
halfFilledColor:
|
||||
MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
||||
isHalfAllowed: true,
|
||||
initialRating: widget.rating,
|
||||
maxRating: 5,
|
||||
),
|
||||
// Text(
|
||||
// "Rating: ${widget.rating}",
|
||||
// style: TextStyle(
|
||||
// fontSize: 15,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// height: 1.0,
|
||||
// ),
|
||||
// ),
|
||||
// Divider(
|
||||
// color: MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// ),
|
||||
const SizedBox(height: 10),
|
||||
_buildContactInfo(
|
||||
"Call",
|
||||
@@ -371,7 +402,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
"Location",
|
||||
"Come visit us.",
|
||||
Icons.location_on,
|
||||
const Color(0xffe9e8a1),
|
||||
const Color(0xffd69d7d),
|
||||
() {
|
||||
final latitude = double.parse(widget.gpsLocation.split(',')[0]);
|
||||
final longitude =
|
||||
@@ -410,7 +441,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
// "Rate Us",
|
||||
// "Let us know how we are doing.",
|
||||
// Icons.star_rate_rounded,
|
||||
// const Color(0xffd69d7d),
|
||||
// const Color(0xffe9e8a1),
|
||||
// () {
|
||||
// print("Opeining rating dialog");
|
||||
// // _launchWebsite(widget.website);
|
||||
|
||||
@@ -684,7 +684,9 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||
cellNumber: widget.arguments.business!.contact_no,
|
||||
email: widget.arguments.business!.bus_email,
|
||||
gpsLocation: widget.arguments.business!.gps_location,
|
||||
//To-Do: Add the business Website
|
||||
rating: widget.arguments.business!.rating.isNotEmpty
|
||||
? double.parse(widget.arguments.business!.rating)
|
||||
: 0,
|
||||
website: widget.arguments.business!.website,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -166,7 +166,9 @@ class _MihBusinessDetailsViewState extends State<MihBusinessDetailsView> {
|
||||
cellNumber: widget.business.contact_no,
|
||||
email: widget.business.bus_email,
|
||||
gpsLocation: widget.business.gps_location,
|
||||
//To-Do: Add the business Website
|
||||
rating: widget.business.rating.isNotEmpty
|
||||
? double.parse(widget.business.rating)
|
||||
: 0,
|
||||
website: widget.business.website,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user