Browse Source

merapikan kodingan web home

Yulian 2 months ago
parent
commit
5c432946cc
1 changed files with 21 additions and 20 deletions
  1. 21 20
      lib/src/layouts/web/menu_home.dart

+ 21 - 20
lib/src/layouts/web/menu_home.dart

@@ -120,10 +120,10 @@ class _WebHomePageState extends State<WebHomePage> {
                                 alignment: Alignment.topRight,
                                 children: [
                                   U.iconsax('sms-notification', color: primaryColor),
-                                  Provider.of<ServiceModule>(context).unreadMessage() ? Container(
+                                  if(Provider.of<ServiceModule>(context).unreadMessage()) Container(
                                     width: 9, height: 9, margin: EdgeInsets.only(top: 1.3),
                                     decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(50))),
-                                  ):Container()
+                                  ),
                                 ],
                               ),
                             ),
@@ -159,10 +159,10 @@ class _WebHomePageState extends State<WebHomePage> {
                           ).withHover()
                         ],
                       ),
-                      Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()] != null ? Padding(
+                      if(Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()] != null) Padding(
                         padding: EdgeInsets.fromLTRB(15, 5, 15, 0),
                         child: Text(Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()], style: TextStyle(color: Colors.white, fontSize: 14), overflow: TextOverflow.ellipsis),
-                      ) : Container(),
+                      ),
                     ],
                   ),
                 ),
@@ -295,7 +295,6 @@ class _WebHomePageState extends State<WebHomePage> {
                                     Expanded(
                                       child: Container(
                                         width: double.infinity, height: double.infinity,
-                                        child: Provider.of<ServiceModule>(context).banner()[i]['image'] != null ? null : Center(child: Text("noImage".tr(), style: TextStyle(fontStyle: FontStyle.italic, color: Colors.black38), textAlign: TextAlign.center)),
                                         decoration: BoxDecoration(
                                           color: textColor.withValues(alpha: 0.1),
                                           borderRadius: BorderRadius.all(Radius.circular(12)),
@@ -304,6 +303,7 @@ class _WebHomePageState extends State<WebHomePage> {
                                             fit: BoxFit.cover,
                                           ):null,
                                         ),
+                                        child: Provider.of<ServiceModule>(context).banner()[i]['image'] != null ? null : Center(child: Text("noImage".tr(), style: TextStyle(fontStyle: FontStyle.italic, color: Colors.black38), textAlign: TextAlign.center)),
                                       ),
                                     ),
                                     Container(
@@ -350,7 +350,7 @@ class _WebHomePageState extends State<WebHomePage> {
                         ) : Container(),
                       ):Container(),
 
-                      Provider.of<UserModule>(context).profile()['topMenu']['show'] != null && Provider.of<UserModule>(context).profile()['topMenu']['show'] == true ? Container(
+                      if(Provider.of<UserModule>(context).profile()['topMenu']['show'] != null && Provider.of<UserModule>(context).profile()['topMenu']['show'] == true) Container(
                         margin: EdgeInsets.only(top: 25, bottom: 25),
                         padding: EdgeInsets.only(top: 20, bottom: 10),
                         decoration: BoxDecoration(color: Colors.white, border: Border.all(color: textColor.withValues(alpha: 0.15)), borderRadius: BorderRadius.all(Radius.circular(12))),
@@ -362,7 +362,7 @@ class _WebHomePageState extends State<WebHomePage> {
                                 double minHeight = 135;
                                 return Row(
                                   children: [
-                                    Provider.of<ServiceModule>(context).topMenu() != null ? Row(
+                                    if(Provider.of<ServiceModule>(context).topMenu() != null) Row(
                                       children: List.generate(Provider.of<ServiceModule>(context).topMenu()!.length+1, (i) {
                                         bool hideOther = i == Provider.of<ServiceModule>(context).topMenu()!.length && U.servantDisplay() && Provider.of<ServiceModule>(context).reqGroup()!.length == 0;
                                         return ConstrainedBox(
@@ -378,18 +378,18 @@ class _WebHomePageState extends State<WebHomePage> {
                                                   hideOther ? Container(width: size/1.8) : i == Provider.of<ServiceModule>(context).topMenu()!.length ? Container(
                                                     child: Container(
                                                       padding: EdgeInsets.all(5),
-                                                      child: SizedBox(width: size/1.8, height: size/1.8, child: U.iconsax('category', color: Color(0xff564F4F), size: 34)),
                                                       decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(20)), boxShadow: [BoxShadow(color: Colors.grey.withValues(alpha: 0.3), blurRadius: 3, offset: Offset(0, 1))]),
+                                                      child: SizedBox(width: size/1.8, height: size/1.8, child: U.iconsax('category', color: Color(0xff564F4F), size: 34)),
                                                     ),
                                                   ) : Container(
                                                     padding: EdgeInsets.all(5),
-                                                    child: Image(image: CachedNetworkImageProvider(Provider.of<ServiceModule>(context).topMenu()![i]['iconUrl']+'?bridge-cache=true', cacheManager: CacheManager(CacheMan.config(Provider.of<ServiceModule>(context).topMenu()![i]['iconUrl']+'?bridge-cache=true'))), width: size/1.8, height: size/1.8),
                                                     decoration: BoxDecoration(
                                                         color: Colors.white,
                                                         borderRadius: BorderRadius.all(Radius.circular(20)),
                                                         border: Border.all(width: 0.2, color: Colors.black12),
                                                         boxShadow: [BoxShadow(color: Colors.grey.withValues(alpha: 0.3), blurRadius: 2, offset: Offset(0, 2))]
                                                     ),
+                                                    child: Image(image: CachedNetworkImageProvider(Provider.of<ServiceModule>(context).topMenu()![i]['iconUrl']+'?bridge-cache=true', cacheManager: CacheManager(CacheMan.config(Provider.of<ServiceModule>(context).topMenu()![i]['iconUrl']+'?bridge-cache=true'))), width: size/1.8, height: size/1.8),
                                                   ),
                                                   SizedBox(height: hideOther ? 0:8),
                                                   Expanded(
@@ -414,8 +414,8 @@ class _WebHomePageState extends State<WebHomePage> {
                                           ),
                                         );
                                       }),
-                                    ) : Container(),
-                                    Provider.of<UserModule>(context).user()['checkedIn'] && Provider.of<UserModule>(context).houseKeeping() && Provider.of<UserModule>(context).dndStatus() ? GestureDetector(
+                                    ),
+                                    if(Provider.of<UserModule>(context).user()['checkedIn'] && Provider.of<UserModule>(context).houseKeeping() && Provider.of<UserModule>(context).dndStatus()) GestureDetector(
                                       child: Container(
                                         width: size*2, padding: EdgeInsets.symmetric(horizontal: 25),
                                         decoration: BoxDecoration(border: Border(left: BorderSide(color: Colors.grey))),
@@ -439,12 +439,12 @@ class _WebHomePageState extends State<WebHomePage> {
                                           ),
                                         );
                                       }
-                                    ).withHover() : Container()
+                                    ).withHover(),
                                   ],
                                 );
                               },
                             ),
-                            Provider.of<ServiceModule>(context).expand() ? Column(
+                            if(Provider.of<ServiceModule>(context).expand()) Column(
                               children: [
                                 Padding(padding: EdgeInsets.symmetric(horizontal: 30, vertical: 15), child: divider()),
                                 Align(
@@ -509,13 +509,14 @@ class _WebHomePageState extends State<WebHomePage> {
                                   },
                                 )
                               ],
-                            ) : Container(),
+                            ),
                           ],
                         ),
-                      ) : Container(),
-                      Provider.of<UserModule>(context).profile()['topMenu']['show'] != null && Provider.of<UserModule>(context).profile()['topMenu']['show'] == true ? separator() : Container(),
+                      ),
+
+                      if(Provider.of<UserModule>(context).profile()['topMenu']['show'] != null && Provider.of<UserModule>(context).profile()['topMenu']['show'] == true) separator(),
 
-                      Provider.of<UserModule>(context).profile()['specialOffer'] != null && Provider.of<UserModule>(context).profile()['specialOffer']['show'] == true ? Container(
+                      if(Provider.of<UserModule>(context).profile()['specialOffer'] != null && Provider.of<UserModule>(context).profile()['specialOffer']['show'] == true) Container(
                         width: double.infinity,
                         margin: EdgeInsets.only(top: 25),
                         child: Column(
@@ -564,9 +565,9 @@ class _WebHomePageState extends State<WebHomePage> {
                             ) : emptyWidget()
                           ],
                         ),
-                      ) : Container(),
+                      ),
 
-                      Provider.of<UserModule>(context).profile()['frequentlyRequested'] != null && Provider.of<UserModule>(context).profile()['frequentlyRequested']['show'] == true ? Container(
+                      if(Provider.of<UserModule>(context).profile()['frequentlyRequested'] != null && Provider.of<UserModule>(context).profile()['frequentlyRequested']['show'] == true) Container(
                         width: double.infinity,
                         margin: EdgeInsets.only(top: 36, bottom: 25),
                         child: Column(
@@ -619,7 +620,7 @@ class _WebHomePageState extends State<WebHomePage> {
                             ) : emptyWidget(),
                           ],
                         ),
-                      ):Container(),
+                      ),
 
                       Provider.of<UserModule>(context).profile()['quickAction'] != null && Provider.of<UserModule>(context).profile()['quickAction']['show'] == true ? separator() : Container(),
                       Provider.of<UserModule>(context).profile()['quickAction'] != null && Provider.of<UserModule>(context).profile()['quickAction']['show'] == true ? Container(