first commit
This commit is contained in:
49
lib/modules/preview/opacity_dialog.dart
Normal file
49
lib/modules/preview/opacity_dialog.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OpacityDialog extends StatefulWidget {
|
||||
final double initial;
|
||||
const OpacityDialog({super.key, required this.initial});
|
||||
@override
|
||||
_OpacityDialogState createState() => _OpacityDialogState();
|
||||
}
|
||||
|
||||
class _OpacityDialogState extends State<OpacityDialog> {
|
||||
late double val;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
val = widget.initial;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('Opacity Watermark'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Slider(
|
||||
value: val,
|
||||
min: 0.1,
|
||||
max: 1.0,
|
||||
divisions: 9,
|
||||
label: '${(val * 100).toStringAsFixed(0)}%',
|
||||
onChanged: (v) => setState(() => val = v),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text('Preview: ${(val * 100).toStringAsFixed(0)}%'),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('Batal'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, val),
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user