58 lines
1.4 KiB
Dart
58 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CustomMediaQuery extends StatelessWidget {
|
|
const CustomMediaQuery({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
MediaQueryData query = MediaQuery.of(context);
|
|
var data = {
|
|
"size": query.size,
|
|
"devicePixelRatio": query.devicePixelRatio.toStringAsFixed(2),
|
|
"platformBrightness": query.platformBrightness,
|
|
"viewInsets": query.viewInsets,
|
|
};
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
toolbarHeight: 35,
|
|
),
|
|
body: Container(
|
|
height: 200,
|
|
color: Colors.grey.withAlpha(11),
|
|
child: ListView(
|
|
children: data.keys.map((e) => item(e, data[e]!)).toList(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget item(String key, Object data) {
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(5),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
key,
|
|
style:
|
|
const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
Text(
|
|
data.toString(),
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(fontSize: 16, color: Colors.orange),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const Divider(
|
|
height: 1,
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|