end_session.dart 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import 'package:auto_route/auto_route.dart';
  2. import 'package:easy_localization/easy_localization.dart';
  3. import 'package:flutter/foundation.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:http/http.dart' as http;
  6. import 'package:telnow_mobile_new/src/api/api_auth_provider.dart';
  7. import 'package:telnow_mobile_new/src/utils/U.dart';
  8. import '../components/template.dart';
  9. @RoutePage()
  10. class EndSessionPage extends StatefulWidget {
  11. const EndSessionPage({super.key});
  12. @override
  13. State<EndSessionPage> createState() => _EndSessionPageState();
  14. }
  15. class _EndSessionPageState extends State<EndSessionPage> {
  16. @override
  17. Widget build(BuildContext context) {
  18. // bool useAsset = false;
  19. String imageUrl = '';
  20. final ApiAuthProvider apiAuthProvider = ApiAuthProvider();
  21. try {
  22. imageUrl = '${apiAuthProvider.baseUrl}${U.decodeBase64Url(Uri.decodeComponent(U.getAccessCode()!))}/assets/background/tn';
  23. http.head(Uri.parse(imageUrl));
  24. }catch(e){
  25. // useAsset = true;
  26. }
  27. return Scaffold(
  28. resizeToAvoidBottomInset: false,
  29. body: Stack(
  30. children: [
  31. SizedBox(
  32. width: double.infinity, height: double.infinity,
  33. child: Image.network(imageUrl, fit: BoxFit.cover, width: double.infinity, height: double.infinity, errorBuilder: (context, error, stacktrace){
  34. return Image.asset('assets/image/background/background.jpg', fit: BoxFit.cover, width: double.infinity, height: double.infinity);
  35. })
  36. ),
  37. SingleChildScrollView(
  38. child: Container(
  39. padding: EdgeInsets.fromLTRB(16, kIsWeb?105:200, 16, 16),
  40. width: MediaQuery.of(context).size.width,
  41. height: kIsWeb && MediaQuery.of(context).size.height<700 ? 700 : MediaQuery.of(context).size.height,
  42. decoration: BoxDecoration(
  43. gradient: LinearGradient(
  44. begin: Alignment.topCenter, end: Alignment.bottomCenter,
  45. colors: [
  46. primaryColor.withValues(alpha: 0.50), Colors.black.withValues(alpha: 0.91)
  47. ]
  48. )
  49. ),
  50. child: Column(
  51. crossAxisAlignment: CrossAxisAlignment.center,
  52. children: [
  53. Image.asset('assets/image/logo/logo.png', width: 160),
  54. Expanded(
  55. child: Column(
  56. mainAxisAlignment: MainAxisAlignment.start,
  57. children: [
  58. Container(
  59. margin: EdgeInsets.only(top: 100, left: 16, right: 16, bottom: 48),
  60. child: Column(
  61. children: [
  62. Text('endSessionTitle'.tr(), style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500), textAlign: TextAlign.center),
  63. SizedBox(height: 16),
  64. Text('endSessionDesc'.tr(), style: TextStyle(color: Colors.white, fontSize: 16), textAlign: TextAlign.center),
  65. ],
  66. )
  67. ),
  68. GestureDetector(
  69. onTap: (){
  70. setState(() {
  71. token.logout();
  72. context.router.removeLast();
  73. // context.replaceRoute(NamedRoute(name));
  74. context.navigateToPath("/app/${U.getAccessCode()}");
  75. // context.navigateToPath("/app/${U.getAccessCode()}/login");
  76. });
  77. },
  78. child: Container(
  79. padding: EdgeInsets.symmetric(vertical: 32, horizontal: 64),
  80. decoration: BoxDecoration(
  81. color: primaryColor.withValues(alpha: 0.50),
  82. border: Border.all(color: Colors.white),
  83. borderRadius: BorderRadius.all(Radius.circular(12))
  84. ),
  85. child: Row(
  86. mainAxisSize: MainAxisSize.min,
  87. children: [
  88. Text('backToLogin'.tr(), style: TextStyle(color: Colors.white, fontSize: 16)),
  89. ],
  90. ),
  91. ),
  92. ),
  93. ],
  94. ),
  95. ),
  96. SizedBox(height: 5),
  97. Text('${'version'.tr()} ${ApiAuthProvider().displayVersion}', style: TextStyle(color: Colors.white, fontSize: 14)),
  98. SizedBox(height: 5),
  99. Text('Build ${ApiAuthProvider().buildNumber}', style: TextStyle(color: Colors.white, fontSize: 13)),
  100. ],
  101. ),
  102. ),
  103. ),
  104. ],
  105. ),
  106. );
  107. }
  108. }
  109. // class EndSessionPage extends StatelessWidget {
  110. // const EndSessionPage({super.key});
  111. //
  112. // @override
  113. // Widget build(BuildContext context) {
  114. //
  115. // }