forked from alexvasl/drifter_app
167 lines
6.3 KiB
Dart
167 lines
6.3 KiB
Dart
import 'package:drifter/models/models.dart';
|
|
import 'package:drifter/pages/terms_of_service/btn_continue_terms_of_service.dart';
|
|
import 'package:drifter/pages/terms_of_service/terms_of_service_text.dart';
|
|
import 'package:drifter/theme/app_colors.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter/src/widgets/framework.dart';
|
|
import 'package:flutter/src/widgets/placeholder.dart';
|
|
import 'package:qr_flutter/qr_flutter.dart';
|
|
|
|
class QrCodeScreen extends StatefulWidget {
|
|
const QrCodeScreen({super.key});
|
|
|
|
@override
|
|
State<QrCodeScreen> createState() => _QrCodeScreenState();
|
|
}
|
|
|
|
class _QrCodeScreenState extends State<QrCodeScreen> {
|
|
String _publicKey = Keys.npubKey;
|
|
bool isCopied = false;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
leading: IconButton(
|
|
icon: Icon(
|
|
Icons.arrow_back,
|
|
color: AppColors.topNavIconBack,
|
|
),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
),
|
|
elevation: 0,
|
|
backgroundColor: AppColors.mainBackground,
|
|
),
|
|
backgroundColor: AppColors.mainBackground,
|
|
body: Padding(
|
|
padding:
|
|
const EdgeInsets.only(top: 10, right: 16, left: 16, bottom: 16),
|
|
child: Center(
|
|
child: Column(children: [
|
|
Text(
|
|
'Follow me on Nostr',
|
|
style: TextStyle(
|
|
color: Color(0xFF302F38),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 24, bottom: 83, right: 48, left: 48),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(32),
|
|
color: Colors.white,
|
|
),
|
|
height: 406,
|
|
width: double.infinity,
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 32.0, bottom: 10),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(200),
|
|
child: Container(
|
|
width: 80,
|
|
height: 80,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
width: 2, color: Color(0xFFF2EFFF))),
|
|
child: Image.asset('assets/images/avatar.png')),
|
|
),
|
|
),
|
|
Text(
|
|
'Cameron Williams on',
|
|
style: TextStyle(
|
|
color: Color(0xFF302F38),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
SizedBox(height: 4),
|
|
Text(
|
|
'@cameron',
|
|
style: TextStyle(
|
|
fontSize: 12, color: AppColors.profileUserName),
|
|
),
|
|
SizedBox(height: 20),
|
|
Container(
|
|
width: 230,
|
|
child: Text(_publicKey,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.profileSocialLinks))),
|
|
SizedBox(height: 20),
|
|
Container(
|
|
width: 143,
|
|
height: 143,
|
|
child: QrImageView(
|
|
eyeStyle: QrEyeStyle(
|
|
color: AppColors.qrCodeBody,
|
|
eyeShape: QrEyeShape.square),
|
|
dataModuleStyle:
|
|
QrDataModuleStyle(color: AppColors.qrCodeBody),
|
|
embeddedImage: AssetImage(
|
|
'assets/images/logo/drifter_logo_white.png'),
|
|
data: _publicKey,
|
|
version: QrVersions.auto,
|
|
),
|
|
),
|
|
],
|
|
)),
|
|
),
|
|
Expanded(child: SizedBox()),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 56,
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(100)),
|
|
backgroundColor: AppColors.buttonSecondaryDefaultBg),
|
|
onPressed: () {
|
|
Clipboard.setData(ClipboardData(text: _publicKey))
|
|
.then((value) {
|
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
content: Text('Copied to clipboard'),
|
|
));
|
|
isCopied = true;
|
|
setState(() {});
|
|
});
|
|
},
|
|
child: isCopied
|
|
? Text(
|
|
'Copied',
|
|
style: TextStyle(color: AppColors.buttonSecondaryText),
|
|
)
|
|
: Text(
|
|
'Copy user ID',
|
|
style: TextStyle(color: AppColors.buttonSecondaryText),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 12),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 56,
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(100)),
|
|
backgroundColor: AppColors.buttonPrimaryDefaultBg),
|
|
onPressed: () {},
|
|
child: Text(
|
|
'Share QR code',
|
|
style: TextStyle(color: AppColors.buttonPrimaryDefaultText),
|
|
),
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|