74 lines
2.7 KiB
Dart
74 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:praresi/services/bubble_services.dart';
|
|
|
|
class BubbleWidget extends StatelessWidget {
|
|
const BubbleWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ValueListenableBuilder<bool>(
|
|
valueListenable: BubbleService().isActive,
|
|
builder: (context, isActive, _) {
|
|
if (!isActive) return const SizedBox.shrink();
|
|
|
|
return Align(
|
|
alignment: Alignment.bottomRight,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (ctx) {
|
|
final controller = TextEditingController();
|
|
return AlertDialog(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12)),
|
|
title: const Text('Input / Salin Alamat'),
|
|
content: TextField(
|
|
controller: controller,
|
|
maxLines: 3,
|
|
decoration: const InputDecoration(
|
|
hintText: 'Masukkan teks di sini...',
|
|
border: OutlineInputBorder(),
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx),
|
|
child: const Text('Tutup'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
final text = controller.text.trim();
|
|
if (text.isNotEmpty) {
|
|
ScaffoldMessenger.of(ctx).showSnackBar(
|
|
SnackBar(content: Text('Teks dikirim: $text')),
|
|
);
|
|
}
|
|
Navigator.pop(ctx);
|
|
},
|
|
child: const Text('Kirim'),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
},
|
|
child: Container(
|
|
width: 60,
|
|
height: 60,
|
|
decoration: const BoxDecoration(
|
|
color: Colors.blueAccent,
|
|
shape: BoxShape.circle,
|
|
boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 8)],
|
|
),
|
|
child: const Icon(Icons.chat_bubble, color: Colors.white, size: 32),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
} |