|
|
@@ -51,14 +51,19 @@ class _WebHomePageState extends State<WebHomePage> {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- if(U.isCompatibleWith(VersionKey.multiBahasa)) {
|
|
|
- homeFunc.getContactCenter(context);
|
|
|
- }
|
|
|
+ checkCompatibility();
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
}
|
|
|
bool _timeLimit = false;
|
|
|
|
|
|
+ checkCompatibility() async{
|
|
|
+ var isCompatible = await U.isCompatibleWith(VersionKey.multiBahasa);
|
|
|
+ if(isCompatible) {
|
|
|
+ homeFunc.getContactCenter(context);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Provider.of<UserModule>(context).user().isNotEmpty?Scaffold(
|
|
|
@@ -100,14 +105,37 @@ class _WebHomePageState extends State<WebHomePage> {
|
|
|
),
|
|
|
),
|
|
|
SizedBox(width: 30),
|
|
|
- U.isCompatibleWith(VersionKey.multiBahasa) && Provider.of<ServiceModule>(context, listen: false).contactCenter().toString() != '' ? Container(
|
|
|
- padding: EdgeInsets.all(8),
|
|
|
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
- child: GestureDetector(
|
|
|
- onTap: () => launchUrl(Uri.parse(Provider.of<ServiceModule>(context, listen: false).contactCenter().toString())),
|
|
|
- child: U.iconsax('phone-number', color: primaryColor, size: 26.0)
|
|
|
- ),
|
|
|
- ):SizedBox(),
|
|
|
+ FutureBuilder(future: U.isCompatibleWith(VersionKey.multiBahasa), builder: (context, snapshot){
|
|
|
+ if(!snapshot.hasData){
|
|
|
+ return SizedBox();
|
|
|
+ }
|
|
|
+ final isCompatible = snapshot.data!;
|
|
|
+ final hasContactCenter = Provider.of<ServiceModule>(context, listen: false)
|
|
|
+ .contactCenter()
|
|
|
+ .toString()
|
|
|
+ .isNotEmpty;
|
|
|
+
|
|
|
+ if (isCompatible && hasContactCenter) {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.all(8),
|
|
|
+ decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () => launchUrl(Uri.parse(Provider.of<ServiceModule>(context, listen: false).contactCenter().toString())),
|
|
|
+ child: U.iconsax('phone-number', color: primaryColor, size: 26.0)
|
|
|
+ ),
|
|
|
+ ); // replace with the widget you want to show
|
|
|
+ } else {
|
|
|
+ return SizedBox(); // or nothing
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ // U.isCompatibleWith(VersionKey.multiBahasa) && Provider.of<ServiceModule>(context, listen: false).contactCenter().toString() != '' ? Container(
|
|
|
+ // padding: EdgeInsets.all(8),
|
|
|
+ // decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
+ // child: GestureDetector(
|
|
|
+ // onTap: () => launchUrl(Uri.parse(Provider.of<ServiceModule>(context, listen: false).contactCenter().toString())),
|
|
|
+ // child: U.iconsax('phone-number', color: primaryColor, size: 26.0)
|
|
|
+ // ),
|
|
|
+ // ):SizedBox(),
|
|
|
SizedBox(width: 10),
|
|
|
GestureDetector(
|
|
|
child: Container(
|