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:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.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 email;
|
||||||
final String gpsLocation;
|
final String gpsLocation;
|
||||||
final String? website;
|
final String? website;
|
||||||
|
final double rating;
|
||||||
const MihBusinessCard({
|
const MihBusinessCard({
|
||||||
super.key,
|
super.key,
|
||||||
required this.businessName,
|
required this.businessName,
|
||||||
required this.cellNumber,
|
required this.cellNumber,
|
||||||
required this.email,
|
required this.email,
|
||||||
required this.gpsLocation,
|
required this.gpsLocation,
|
||||||
|
required this.rating,
|
||||||
this.website,
|
this.website,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -336,6 +339,34 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
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),
|
const SizedBox(height: 10),
|
||||||
_buildContactInfo(
|
_buildContactInfo(
|
||||||
"Call",
|
"Call",
|
||||||
@@ -371,7 +402,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
"Location",
|
"Location",
|
||||||
"Come visit us.",
|
"Come visit us.",
|
||||||
Icons.location_on,
|
Icons.location_on,
|
||||||
const Color(0xffe9e8a1),
|
const Color(0xffd69d7d),
|
||||||
() {
|
() {
|
||||||
final latitude = double.parse(widget.gpsLocation.split(',')[0]);
|
final latitude = double.parse(widget.gpsLocation.split(',')[0]);
|
||||||
final longitude =
|
final longitude =
|
||||||
@@ -410,7 +441,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
// "Rate Us",
|
// "Rate Us",
|
||||||
// "Let us know how we are doing.",
|
// "Let us know how we are doing.",
|
||||||
// Icons.star_rate_rounded,
|
// Icons.star_rate_rounded,
|
||||||
// const Color(0xffd69d7d),
|
// const Color(0xffe9e8a1),
|
||||||
// () {
|
// () {
|
||||||
// print("Opeining rating dialog");
|
// print("Opeining rating dialog");
|
||||||
// // _launchWebsite(widget.website);
|
// // _launchWebsite(widget.website);
|
||||||
|
|||||||
@@ -684,7 +684,9 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
cellNumber: widget.arguments.business!.contact_no,
|
cellNumber: widget.arguments.business!.contact_no,
|
||||||
email: widget.arguments.business!.bus_email,
|
email: widget.arguments.business!.bus_email,
|
||||||
gpsLocation: widget.arguments.business!.gps_location,
|
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,
|
website: widget.arguments.business!.website,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -166,7 +166,9 @@ class _MihBusinessDetailsViewState extends State<MihBusinessDetailsView> {
|
|||||||
cellNumber: widget.business.contact_no,
|
cellNumber: widget.business.contact_no,
|
||||||
email: widget.business.bus_email,
|
email: widget.business.bus_email,
|
||||||
gpsLocation: widget.business.gps_location,
|
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,
|
website: widget.business.website,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user