From 4f37bb9476e79a4f08dfa2eadbbd038d824c3009 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 9 May 2023 10:22:52 +0300 Subject: [PATCH] improvements. --- lib/controllers/api_routes/urls.dart | 4 +- .../providers/api/notifications_provider.dart | 2 +- lib/views/pages/user/land_page.dart | 14 +-- .../parts/auto_complete_parts_field.dart | 102 ++++++++---------- 4 files changed, 55 insertions(+), 67 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 95b6027c..cf4849fd 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -1,9 +1,9 @@ class URLs{ URLs._(); static const host2 = "http://194.163.164.213/atoms/api"; - // static const host1 = "https://atomsdev.hmg.com/api"; // uat url + static const host1 = "https://atomsuat.hmg.com"; // uat url - static const host1 = "http://109.123.243.118:9000"; + // static const host1 = "http://109.123.243.118:9000"; static String _baseUrl = "$_host/mobile"; diff --git a/lib/controllers/providers/api/notifications_provider.dart b/lib/controllers/providers/api/notifications_provider.dart index 0f216a0a..14afc4b7 100644 --- a/lib/controllers/providers/api/notifications_provider.dart +++ b/lib/controllers/providers/api/notifications_provider.dart @@ -53,7 +53,7 @@ class NotificationsProvider extends ChangeNotifier{ // userId = 397.toString(); // testing id to view data try{ response = await get( - Uri.parse(host+URLs.getNotifications + Uri.parse(URLs.getNotifications +"?uid=${user.id}" "&token=${user.token}" "&page=${(notifications?.length ?? 0) ~/pageItemNumber}"), diff --git a/lib/views/pages/user/land_page.dart b/lib/views/pages/user/land_page.dart index 190b365c..41c4826c 100644 --- a/lib/views/pages/user/land_page.dart +++ b/lib/views/pages/user/land_page.dart @@ -330,13 +330,13 @@ class _LandPageState extends State { ), ], ), - DrawerItem( - icon: Icons.notifications, - title: _subtitle.notifications, - onPressed: () { - Navigator.of(context).pushNamed(NotificationsPage.id); - }, - ), + // DrawerItem( + // icon: Icons.notifications, + // title: _subtitle.notifications, + // onPressed: () { + // Navigator.of(context).pushNamed(NotificationsPage.id); + // }, + // ), DrawerItem( icon: Icons.mail, title: _subtitle.email, diff --git a/lib/views/widgets/parts/auto_complete_parts_field.dart b/lib/views/widgets/parts/auto_complete_parts_field.dart index 893d2f91..025b6e1d 100644 --- a/lib/views/widgets/parts/auto_complete_parts_field.dart +++ b/lib/views/widgets/parts/auto_complete_parts_field.dart @@ -43,66 +43,54 @@ class _AutoCompletePartsFieldState extends State { _userProvider = Provider.of(context); _partsProvider = Provider.of(context); //Subtitle _subtitle = AppLocalization.of(context).subtitle; - return LoadingManager( - isLoading: _partsProvider.isLoading, - isFailedLoading: _partsProvider.parts == null, - stateCode: _partsProvider.stateCode, - onRefresh: () async { - _partsProvider.reset(); - await _partsProvider.getParts( - host: _settingProvider.host, - user: _userProvider.user, - ); - }, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 16 + return Container( + padding: const EdgeInsets.symmetric( + horizontal: 16 + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color:AColors.black), + borderRadius: BorderRadius.circular( + AppStyle.borderRadius * AppStyle.getScaleFactor(context) ), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color:AColors.black), - borderRadius: BorderRadius.circular( - AppStyle.borderRadius * AppStyle.getScaleFactor(context) - ), - boxShadow: const [ - AppStyle.boxShadow - ] - ), - child: TypeAheadField( - textFieldConfiguration: TextFieldConfiguration( - style: Theme.of(context).textTheme.subtitle1, - controller: _controller, - textAlign: TextAlign.center, - decoration: const InputDecoration( - border: InputBorder.none, - disabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), - textInputAction: TextInputAction.search, - ), - suggestionsCallback: (vale) async { - return await _partsProvider.getPartsList( - host: _settingProvider.host, - title: vale - ); - }, - itemBuilder: (context, part) { - return ListTile( - title: Text(part.code), - subtitle: Text(part.name, style: Theme.of(context).textTheme.caption,), - ); - }, - onSuggestionSelected: (part) { - if(widget.clearAfterPick){ - _controller.clear(); - } else{ - _controller.text = part.code; - } - widget.onPick(part); - }, + boxShadow: const [ + AppStyle.boxShadow + ] + ), + child: TypeAheadField( + textFieldConfiguration: TextFieldConfiguration( + style: Theme.of(context).textTheme.subtitle1, + controller: _controller, + textAlign: TextAlign.center, + decoration: const InputDecoration( + border: InputBorder.none, + disabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), + textInputAction: TextInputAction.search, ), + suggestionsCallback: (vale) async { + return await _partsProvider.getPartsList( + host: _settingProvider.host, + title: vale + ); + }, + itemBuilder: (context, part) { + return ListTile( + title: Text(part.code), + subtitle: Text(part.name, style: Theme.of(context).textTheme.caption,), + ); + }, + onSuggestionSelected: (part) { + if(widget.clearAfterPick){ + _controller.clear(); + } else{ + _controller.text = part.code; + } + widget.onPick(part); + }, + ), ); } }