user_share_page.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_riverpod/flutter_riverpod.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:news_app/main.dart';
  6. import 'package:news_app/util/share_util.dart';
  7. import 'package:news_app/widget/load_image.dart';
  8. import 'package:news_app/widget/my_txt.dart';
  9. import '../../gen/assets.gen.dart';
  10. import '../../util/theme_util.dart';
  11. /// @author: bo.zeng
  12. /// @email: cnhbwds@gmail.com
  13. /// @date: 2025 2025/4/9 16:00
  14. /// @description:
  15. class UserSharePage extends ConsumerWidget {
  16. const UserSharePage({super.key});
  17. @override
  18. Widget build(BuildContext context, WidgetRef ref) {
  19. setImmersiveStatusBar();
  20. final user = ref.read(globalUserProvider);
  21. return Scaffold(
  22. appBar: AppBar(
  23. backgroundColor: Colors.blue.shade300,
  24. elevation: 0,
  25. systemOverlayStyle: SystemUiOverlayStyle(
  26. statusBarColor: Colors.blue.shade300,
  27. statusBarIconBrightness: Brightness.light,
  28. ),
  29. leading: IconButton(
  30. icon: Icon(Icons.arrow_back, color: Colors.white),
  31. onPressed: () {
  32. Navigator.pop(context);
  33. },
  34. ),
  35. title: myTxt(
  36. text: '分享app',
  37. color: Colors.white,
  38. fontSize: 18.sp,
  39. fontWeight: FontWeight.bold,
  40. ),
  41. centerTitle: true,
  42. ),
  43. body: Container(
  44. width: double.infinity,
  45. decoration: BoxDecoration(
  46. gradient: LinearGradient(
  47. colors: [Colors.blue.shade300, Colors.blue.shade700],
  48. begin: Alignment.topCenter,
  49. end: Alignment.bottomCenter,
  50. ),
  51. ),
  52. child: Column(
  53. children: [
  54. SizedBox(height: 20),
  55. Container(
  56. margin: EdgeInsets.all(20),
  57. padding: EdgeInsets.all(20),
  58. decoration: BoxDecoration(
  59. color: Colors.white,
  60. borderRadius: BorderRadius.circular(15),
  61. boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 5)],
  62. ),
  63. child: Column(
  64. children: [
  65. CircleAvatar(
  66. radius: 40,
  67. backgroundImage: AssetImage(
  68. Assets.images.userAvatar.path,
  69. ), // 替换为你的头像资源
  70. ),
  71. SizedBox(height: 10),
  72. Text(
  73. user.nickName ?? "",
  74. style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
  75. ),
  76. SizedBox(height: 5),
  77. Text(
  78. user.description ?? "",
  79. style: TextStyle(color: Colors.grey),
  80. ),
  81. SizedBox(height: 20),
  82. LoadImage(user.shareUrl ?? '', width: 220.w,height: 220.h,fit: BoxFit.fitHeight,holderImg: 'qrnone',),
  83. // QrImageView(
  84. // data: 'https://xxf-2.dynamicycle.com/member_preview/share/670849635270725.png',
  85. // version: QrVersions.auto,
  86. // size: 220.w,
  87. // ),
  88. SizedBox(height: 20),
  89. SizedBox(
  90. width: double.infinity,
  91. height: 50,
  92. child: ElevatedButton(
  93. style: ElevatedButton.styleFrom(
  94. backgroundColor: Colors.blue.shade400,
  95. shape: RoundedRectangleBorder(
  96. borderRadius: BorderRadius.circular(25),
  97. ),
  98. ),
  99. onPressed: () {
  100. shareImage(title: "新华新消费", imageUrl: user.shareUrl??'');
  101. },
  102. child: Text(
  103. '分享给好友',
  104. style: TextStyle(fontSize: 18, color: Colors.white),
  105. ),
  106. ),
  107. ),
  108. ],
  109. ),
  110. ),
  111. ],
  112. ),
  113. ),
  114. );
  115. }
  116. }