diff --git a/lib/ui/screens/sandbox.dart b/lib/ui/screens/sandbox.dart index eefd607e6fcdac8625dad87d17eb1b3c47ece76e..4a32b78a92f765907d9da95df22bfcaaef97e31d 100644 --- a/lib/ui/screens/sandbox.dart +++ b/lib/ui/screens/sandbox.dart @@ -1,6 +1,6 @@ import 'package:flutter_neumorphic/flutter_neumorphic.dart'; -import '../widgets/first_screen/card_name_editable.dart'; +import '../widgets/first_screen/credit_card.dart'; class Sandbox extends StatefulWidget { const Sandbox({super.key}); @@ -10,12 +10,68 @@ class Sandbox extends StatefulWidget { } class _SandboxState extends State<Sandbox> { + final double expandedHeight = 500; + @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text('Sandbox'), - ), - body: const CardNameEditable()); + body: CustomScrollView( + slivers: <Widget>[ + SliverAppBar( + expandedHeight: expandedHeight, + pinned: true, + flexibleSpace: LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + // Calcula la proporción de la altura actual respecto a la altura expandida + final double percent = + (expandedHeight - constraints.maxHeight) / expandedHeight; + + return Stack( + fit: StackFit.expand, + children: <Widget>[ + // CreditCard(), + Positioned( + top: 0, + left: 0, + child: ClipRect( + child: AnimatedOpacity( + opacity: 1 - percent, + duration: const Duration(milliseconds: 200), + child: CreditCard(), + ), + ), + ), + Positioned( + bottom: 16, + left: 36, + child: ClipRect( + child: AnimatedOpacity( + opacity: percent, + duration: const Duration(milliseconds: 200), + child: Text( + 'Mi AppBar', + style: Theme.of(context) + .textTheme + .headlineSmall + ?.copyWith(color: Colors.white), + ), + ), + ), + ), + ], + ); + }), + ), + SliverList( + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) => ListTile( + title: Text('Item $index'), + ), + childCount: 50, + ), + ), + ], + ), + ); } } diff --git a/lib/ui/widgets/fifth_screen/import_clipboard_dialog.dart b/lib/ui/widgets/fifth_screen/import_clipboard_dialog.dart new file mode 100644 index 0000000000000000000000000000000000000000..7ae0d7c71292a4e89c3258289824c012487d221c --- /dev/null +++ b/lib/ui/widgets/fifth_screen/import_clipboard_dialog.dart @@ -0,0 +1,58 @@ +import 'package:clipboard/clipboard.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; + +class ImportClipboardDialog extends StatefulWidget { + const ImportClipboardDialog({super.key, required this.onImport}); + + final Function(String) onImport; + + @override + State<ImportClipboardDialog> createState() => _ImportClipboardDialogState(); +} + +class _ImportClipboardDialogState extends State<ImportClipboardDialog> { + final TextEditingController _textController = TextEditingController(); + + Future<void> _pasteFromClipboard() async { + FlutterClipboard.paste().then((String? value) { + setState(() { + if (value != null) { + _textController.text = value; + } + }); + }); + } + + @override + Widget build(BuildContext context) { + return AlertDialog( + title: Text(tr('import_wallet_from_clipboard')), + content: Column( + mainAxisSize: MainAxisSize.min, + children: <Widget>[ + Text(tr('import_wallet_from_clipboard_desc')), + TextField( + controller: _textController, + maxLines: 5, + decoration: InputDecoration(hintText: tr('paste_here')), + ), + const SizedBox(height: 10), + TextButton( + onPressed: _pasteFromClipboard, + child: Text(tr('paste')), + ), + ], + ), + actions: <Widget>[ + TextButton( + child: Text(tr('import')), + onPressed: () { + Navigator.of(context).pop(_textController.text); + widget.onImport(_textController.text); + }, + ), + ], + ); + } +}