-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* show sheet for qr code * fix lint * show description instead of id * release build fails * add padding
- Loading branch information
1 parent
3f054cc
commit 8f6cb3f
Showing
9 changed files
with
222 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:khelo/domain/extensions/context_extensions.dart'; | ||
import 'package:qr_flutter/qr_flutter.dart'; | ||
import 'package:style/button/action_button.dart'; | ||
import 'package:style/extensions/context_extensions.dart'; | ||
import 'package:style/text/app_text_style.dart'; | ||
|
||
class QrCodeSheet extends StatelessWidget { | ||
final String userId; | ||
|
||
static Future<T?> show<T>( | ||
BuildContext context, { | ||
required String userId, | ||
}) { | ||
HapticFeedback.mediumImpact(); | ||
return showModalBottomSheet( | ||
context: context, | ||
showDragHandle: false, | ||
enableDrag: false, | ||
isScrollControlled: true, | ||
useRootNavigator: true, | ||
backgroundColor: context.colorScheme.surface, | ||
builder: (context) => QrCodeSheet(userId: userId), | ||
); | ||
} | ||
|
||
const QrCodeSheet({super.key, required this.userId}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
constraints: | ||
BoxConstraints(maxHeight: context.mediaQuerySize.height * 0.8), | ||
decoration: BoxDecoration( | ||
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)), | ||
color: context.colorScheme.surface, | ||
), | ||
child: SingleChildScrollView( | ||
padding: context.mediaQueryPadding + | ||
const EdgeInsets.symmetric(vertical: 24, horizontal: 16), | ||
child: Column( | ||
children: [ | ||
Align( | ||
alignment: Alignment.centerRight, | ||
child: actionButton(context, | ||
icon: Icon( | ||
Icons.close, | ||
color: context.colorScheme.textSecondary, | ||
), | ||
onPressed: context.pop)), | ||
const SizedBox(height: 24), | ||
QrImageView( | ||
data: userId, | ||
version: QrVersions.auto, | ||
size: 240, | ||
dataModuleStyle: QrDataModuleStyle( | ||
dataModuleShape: QrDataModuleShape.square, | ||
color: context.colorScheme.textPrimary), | ||
eyeStyle: QrEyeStyle( | ||
eyeShape: QrEyeShape.square, | ||
color: context.colorScheme.textPrimary), | ||
), | ||
const SizedBox(height: 24), | ||
Text( | ||
context.l10n.profile_setting_use_scanner_description, | ||
textAlign: TextAlign.center, | ||
style: AppTextStyle.subtitle1 | ||
.copyWith(color: context.colorScheme.textSecondary), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.