import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:news_app/main.dart'; import 'package:news_app/util/share_util.dart'; import 'package:news_app/widget/load_image.dart'; import 'package:news_app/widget/my_txt.dart'; import '../../gen/assets.gen.dart'; import '../../util/theme_util.dart'; /// @author: bo.zeng /// @email: cnhbwds@gmail.com /// @date: 2025 2025/4/9 16:00 /// @description: class UserSharePage extends ConsumerWidget { const UserSharePage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { setImmersiveStatusBar(); final user = ref.read(globalUserProvider); return Scaffold( appBar: AppBar( backgroundColor: Colors.blue.shade300, elevation: 0, systemOverlayStyle: SystemUiOverlayStyle( statusBarColor: Colors.blue.shade300, statusBarIconBrightness: Brightness.light, ), leading: IconButton( icon: Icon(Icons.arrow_back, color: Colors.white), onPressed: () { Navigator.pop(context); }, ), title: myTxt( text: '分享app', color: Colors.white, fontSize: 18.sp, fontWeight: FontWeight.bold, ), centerTitle: true, ), body: Container( width: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( colors: [Colors.blue.shade300, Colors.blue.shade700], begin: Alignment.topCenter, end: Alignment.bottomCenter, ), ), child: Column( children: [ SizedBox(height: 20), Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(20), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 5)], ), child: Column( children: [ CircleAvatar( radius: 40, backgroundImage: AssetImage( Assets.images.userAvatar.path, ), // 替换为你的头像资源 ), SizedBox(height: 10), Text( user.nickName ?? "", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), SizedBox(height: 5), Text( user.description ?? "", style: TextStyle(color: Colors.grey), ), SizedBox(height: 20), LoadImage(user.shareUrl ?? '', width: 220.w,height: 220.h,fit: BoxFit.fitHeight,holderImg: 'qrnone',), // QrImageView( // data: 'https://xxf-2.dynamicycle.com/member_preview/share/670849635270725.png', // version: QrVersions.auto, // size: 220.w, // ), SizedBox(height: 20), SizedBox( width: double.infinity, height: 50, child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Colors.blue.shade400, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(25), ), ), onPressed: () { shareImage(title: "新华新消费", imageUrl: user.shareUrl??''); }, child: Text( '分享给好友', style: TextStyle(fontSize: 18, color: Colors.white), ), ), ), ], ), ), ], ), ), ); } }