151 lines
4.2 KiB
Dart
151 lines
4.2 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'Constants/Colorconstants.dart';
|
|
|
|
class Utility{
|
|
static Color getLightColors(String character){
|
|
final List alphabets=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
|
|
final List<Color> colors = [
|
|
Colors.blue[100]!,
|
|
Colors.indigo[100]!,
|
|
Colors.lime[100]!,
|
|
Colors.teal[100]!,
|
|
Colors.cyan[100]!,
|
|
Colors.amber[100]!,
|
|
Colors.brown[100]!,
|
|
Colors.green[100]!,
|
|
Colors.lightGreen[100]!,
|
|
Colors.red[100]!,
|
|
Colors.deepPurple[100]!,
|
|
Colors.blueGrey[100]!,
|
|
Colors.yellow[100]!,
|
|
Colors.deepOrange[100]!,
|
|
Colors.teal[100]!,
|
|
Colors.cyan[100]!,
|
|
Colors.amber[100]!,
|
|
Colors.blueGrey[100]!,
|
|
Colors.green[100]!,
|
|
Colors.lightGreen[100]!,
|
|
Colors.red[100]!,
|
|
Colors.deepPurple[100]!,
|
|
Colors.pink[100]!,
|
|
Colors.deepPurple[100]!,
|
|
Colors.purpleAccent[100]!,
|
|
Colors.orange[100]!
|
|
];
|
|
return RegExp(r"^[a-zA-Z]").hasMatch(character)?colors[alphabets.indexOf(character.toUpperCase())]:colors[0];
|
|
}
|
|
|
|
static void openPhoneCallApp(String phoneNumber) {
|
|
launch("tel:$phoneNumber");
|
|
}
|
|
|
|
|
|
static Future<void> openMap(double latitude, double longitude) async {
|
|
String googleUrl =
|
|
'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude';
|
|
if (await canLaunch(googleUrl) != null) {
|
|
await launch(googleUrl);
|
|
} else {
|
|
throw 'Could not open the map.';
|
|
}
|
|
}
|
|
}
|
|
class UtilityPromotion{
|
|
static Color getLightColors(String character){
|
|
|
|
final List alphabets=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
|
|
final List<Color> colors = [
|
|
Colors.blue[200]!,
|
|
Colors.indigo[200]!,
|
|
Colors.lime[200]!,
|
|
Colors.teal[200]!,
|
|
Colors.cyan[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.brown[200]!,
|
|
Colors.green[200]!,
|
|
Colors.lightGreen[200]!,
|
|
Colors.red[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.yellow[200]!,
|
|
Colors.deepOrange[200]!,
|
|
Colors.teal[200]!,
|
|
Colors.cyan[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.green[200]!,
|
|
Colors.lightGreen[200]!,
|
|
Colors.red[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.pink[200]!,
|
|
Colors.deepPurple[200]!,
|
|
Colors.purpleAccent[200]!,
|
|
Colors.orange[200]!
|
|
];
|
|
return RegExp(r"^[a-zA-Z]").hasMatch(character)?colors[alphabets.indexOf(character.toUpperCase())]:colors[0];
|
|
}
|
|
|
|
}
|
|
|
|
|
|
class UtilityCustomers{
|
|
static Color getLightColors(String character){
|
|
final List alphabets=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
|
|
final List<Color> colors = [
|
|
ColorConstants.primaryColor,
|
|
Colors.blue,
|
|
Colors.redAccent,
|
|
Colors.black54,
|
|
Colors.redAccent,
|
|
Colors.black54,
|
|
Colors.black54,
|
|
Colors.orange,
|
|
Colors.purpleAccent,
|
|
Colors.purple,
|
|
Colors.pinkAccent,
|
|
Colors.teal,
|
|
Colors.blue,
|
|
Colors.redAccent,
|
|
Colors.black54,
|
|
Colors.redAccent,
|
|
Colors.black54,
|
|
Colors.purpleAccent,
|
|
Colors.purple,
|
|
Colors.orange,
|
|
Colors.pinkAccent,
|
|
Colors.teal,
|
|
Colors.blue,
|
|
Colors.redAccent,
|
|
Colors.black54,
|
|
Colors.redAccent,
|
|
Colors.black54,
|
|
Colors.pink
|
|
];
|
|
return RegExp(r"^[a-zA-Z]").hasMatch(character)?colors[alphabets.indexOf(character.toUpperCase())]:colors[0];
|
|
}
|
|
}
|
|
|
|
|
|
final Color shoppingColor = Colors.orange[100]!;
|
|
final Color wellnessColor = Colors.cyan[100]!;
|
|
final Color servicesColor = Colors.red[100]!;
|
|
class UtilityModules{
|
|
static Color getLightColors(String character){
|
|
final List alphabets=['RE','GR','SH','HE','HA'];
|
|
final List<Color> colors = [
|
|
Colors.amber[100]!,
|
|
Colors.purple[100]!,
|
|
Colors.orange[100]!,
|
|
Colors.cyan[100]!,
|
|
Colors.red[100]!,
|
|
];
|
|
return RegExp(r"^[a-zA-Z]").hasMatch(character)?colors[alphabets.indexOf(character.toUpperCase())]:colors[0];
|
|
}
|
|
}
|
|
|
|
|