support padding width
This commit is contained in:
1 parent
90f53a0578
commit
b430697b5c
2 files changed
+27
-5
No files matched your search
@@ -9,7 +9,8 @@ import 'package:px_eye/widget/button.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
class ImagePage extends StatefulWidget {
|
||||
const ImagePage({Key? key}) : super(key: key);
|
||||
const ImagePage({Key? key, this.paddingWidth = 100}) : super(key: key);
|
||||
final int paddingWidth;
|
||||
|
||||
@override
|
||||
State<ImagePage> createState() => _ImagePageState();
|
||||
@@ -114,7 +115,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
|
||||
double dy = 0,
|
||||
Function(double dx, double dy)? moveChanged,
|
||||
}) {
|
||||
var width = MediaQuery.of(context).size.width - 100;
|
||||
var width = MediaQuery.of(context).size.width - widget.paddingWidth;
|
||||
if (!show || imageFile == null) {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
+24
-3
@@ -81,13 +81,15 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
|
||||
double width = 800;
|
||||
double height = 1200;
|
||||
|
||||
double paddingWidth = 100;
|
||||
|
||||
Future<void> onClickEnter() async {
|
||||
resetScreen();
|
||||
await Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder<void>(
|
||||
opaque: false,
|
||||
pageBuilder: (_, __, ___) => const ImagePage(),
|
||||
pageBuilder: (_, __, ___) => ImagePage(paddingWidth: paddingWidth.toInt()),
|
||||
));
|
||||
getScreenSize();
|
||||
}
|
||||
@@ -101,7 +103,6 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
|
||||
@override
|
||||
void onWindowResize() {
|
||||
super.onWindowResize();
|
||||
|
||||
}
|
||||
|
||||
void getScreenSize() {
|
||||
@@ -172,9 +173,29 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
|
||||
onSubmitted: (_) => onClickEnter(),
|
||||
),
|
||||
),
|
||||
20.gapRow,
|
||||
'paddingWidth:'.toText(size: 9.dp),
|
||||
SizedBox(
|
||||
height: 20.dp,
|
||||
width: 50.dp,
|
||||
child: TextField(
|
||||
controller: TextEditingController(text: '${paddingWidth.toInt()}'),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
|
||||
onChanged: (number) {
|
||||
paddingWidth = double.tryParse(number) ?? 100;
|
||||
},
|
||||
style: TextStyle(fontSize: 14.dp, fontWeight: FontWeight.w600),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(2.dp),
|
||||
hintStyle: TextStyle(fontSize: 14.dp, color: Colors.grey, fontWeight: FontWeight.w600),
|
||||
),
|
||||
onSubmitted: (_) => onClickEnter(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
'(image width will be width - 100)'.toText(size: 10.dp, color: Colors.grey),
|
||||
'(image width will be width - paddingWidth)'.toText(size: 10.dp, color: Colors.grey),
|
||||
30.dp.gapColumn,
|
||||
EasyButton(
|
||||
text: 'Enter',
|
||||
|
||||
Reference in new issue
Block a user