Commit f1723336 authored by DatHV's avatar DatHV
Browse files

cập nhật ui, lịch sử điểm.. base networking

parent 38520c1e
......@@ -5,6 +5,7 @@ import 'package:share_plus/share_plus.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;
import '../../base/app_loading.dart';
import '../../base/base_screen.dart';
import '../../base/basic_state.dart';
import '../../resources/base_color.dart';
......@@ -33,17 +34,17 @@ class _TrafficServiceCertificateScreenState extends BaseState<TrafficServiceCert
@override
void initState() {
super.initState();
showLoading();
AppLoading().show();
_controller = WebViewController()
..loadRequest(Uri.parse(widget.urlView))
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onPageFinished: (_) async {
hideLoading();
AppLoading().hide();
},
onWebResourceError: (error) {
hideLoading();
AppLoading().hide();
},
),
);
......
......@@ -59,9 +59,8 @@ class _VoucherDetailScreenState extends BaseState<VoucherDetailScreen> with Basi
}
_viewModel = Get.put(VoucherDetailViewModel(productId: productId, customerProductId: customerProductId));
_viewModel.onShowAlertError = (message) {
if (message.isNotEmpty) {
showAlertError(content: message);
}
if (message.isEmpty) return;
showAlertError(content: message);
};
}
......
import 'dart:ui';
import 'package:get/get.dart';
import 'package:mypoint_flutter_app/networking/restful_api_client_all_request.dart';
import 'package:uuid/uuid.dart';
......
......@@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:mypoint_flutter_app/widgets/back_button.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';
import '../../base/app_loading.dart';
import '../../base/base_screen.dart';
import '../../base/basic_state.dart';
import '../../directional/directional_screen.dart';
......@@ -42,7 +43,7 @@ class _BaseWebViewScreenState extends BaseState<BaseWebViewScreen> with BasicSta
});
return;
}
showLoading();
AppLoading().show();
_controller =
WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
......@@ -50,14 +51,14 @@ class _BaseWebViewScreenState extends BaseState<BaseWebViewScreen> with BasicSta
..setNavigationDelegate(
NavigationDelegate(
onPageFinished: (_) async {
hideLoading();
AppLoading().hide();
final title = await _controller.getTitle();
setState(() {
_dynamicTitle = title;
});
},
onWebResourceError: (error) {
hideLoading();
AppLoading().hide();
if (error.description != 'about:blank') {
if (kDebugMode) {
print('WebView error: ${error.description}');
......@@ -101,13 +102,6 @@ class _BaseWebViewScreenState extends BaseState<BaseWebViewScreen> with BasicSta
CustomBackButton(onPressed: _handleBack),
],
),
// AppBar(
// title: Text(
// input.title ?? _dynamicTitle ?? Uri.parse(input.url).host,
// style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.black87),
// ),
// leading: CustomBackButton(onPressed: _handleBack),
// ),
body: Stack(
children: [
SafeArea(
......
import 'package:get/get.dart';
import 'package:mypoint_flutter_app/screen/news/news_list_screen.dart';
import 'package:mypoint_flutter_app/screen/qr_code/qr_code_screen.dart';
import '../screen/achievement/achievement_list_screen.dart';
import '../screen/affiliate/affiliate_tab_screen.dart';
import '../screen/affiliate_brand_detail/affiliate_brand_detail_screen.dart';
......@@ -47,7 +48,6 @@ import '../screen/voucher/voucher_list/voucher_list_screen.dart';
import '../screen/vplay_game_center/vplay_game_center_screen.dart';
import '../screen/webview/payment_web_view_screen.dart';
import '../screen/webview/web_view_screen.dart';
const splashScreen = '/splash';
const onboardingScreen = '/onboarding';
const loginScreen = '/login';
......@@ -96,6 +96,7 @@ const interestCategoriesScreen = '/interestCategoriesScreen';
const myMobileCardListScreen = '/myMobileCardListScreen';
const bankAccountManagerScreen = '/bankAccountManagerScreen';
const historyPointScreen = '/historyPointScreen';
const qrCodeScreen = '/qrCodeScreen';
class RouterPage {
static List<GetPage> pages() {
......@@ -160,6 +161,7 @@ class RouterPage {
GetPage(name: interestCategoriesScreen, page: () => InterestCategoriesScreen()),
GetPage(name: bankAccountManagerScreen, page: () => BankAccountManagerScreen()),
GetPage(name: historyPointScreen, page: () => HistoryPointScreen()),
GetPage(name: qrCodeScreen, page: () => QRCodeScreen()),
];
}
}
\ No newline at end of file
......@@ -38,6 +38,7 @@ class CustomNavigationBar extends StatelessWidget implements PreferredSizeWidget
Widget _buildAppBar(String bgImage, BuildContext context) {
final double statusBarHeight = MediaQuery.of(context).padding.top;
final bool isHttp = bgImage.startsWith('http://') || bgImage.startsWith('https://');
final paddingTitle = (leftButtons.isNotEmpty || rightButtons.isNotEmpty) ? 48.0 : 16.0; // cách 2 đầu
return Container(
height: statusBarHeight + kToolbarHeight,
decoration: BoxDecoration(
......@@ -59,18 +60,36 @@ class CustomNavigationBar extends StatelessWidget implements PreferredSizeWidget
child: Stack(
alignment: Alignment.center,
children: [
Text(
title,
maxLines: 1,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w800, color: Colors.white),
textAlign: TextAlign.center,
Padding(
padding: EdgeInsets.symmetric(horizontal: paddingTitle),
child: FittedBox(
fit: BoxFit.scaleDown, // tự giảm font để vừa khung
child: Text(
title,
maxLines: 1,
softWrap: false,
overflow: TextOverflow.visible, // không dùng ellipsis
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18, // cỡ tối đa
fontWeight: FontWeight.w800,
color: Colors.white,
),
),
),
),
// Text(
// title,
// maxLines: 1,
// style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w800, color: Colors.white),
// textAlign: TextAlign.center,
// ),
// Buttons bên trái
if (leftButtons.isNotEmpty)
Positioned(left: 12, child: Row(mainAxisSize: MainAxisSize.min, children: leftButtons)),
// Buttons bên phải
if (rightButtons != null)
Positioned(right: 12, child: Row(mainAxisSize: MainAxisSize.min, children: rightButtons!)),
if (rightButtons.isNotEmpty)
Positioned(right: 12, child: Row(mainAxisSize: MainAxisSize.min, children: rightButtons)),
],
),
),
......
......@@ -33,8 +33,6 @@ dependencies:
flutter_localizations:
sdk: flutter
dio: ^5.8.0+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
shared_preferences: ^2.5.2
json_annotation: ^4.9.0
......@@ -57,7 +55,6 @@ dependencies:
infinite_carousel: ^1.0.3
package_info_plus: ^4.1.0
dotted_border: ^2.0.0
# contacts_service: ^0.6.3
flutter_contacts: ^1.1.6
permission_handler: ^11.0.0
share_plus: ^7.2.1
......@@ -65,6 +62,9 @@ dependencies:
month_picker_dialog:
marquee: ^2.2.3
fl_chart: ^0.66.2
mobile_scanner: ^3.5.7
encrypt: ^5.0.1
connectivity_plus:
game_miniapp:
path: ../mini_app/game_miniapp
dev_dependencies:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment