flutter_demo_gps/lib/widgets/demo_align_widget.dart

51 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
class DemoAlignWidget extends StatelessWidget {
const DemoAlignWidget({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 300,
child: DefaultTextStyle(
style: const TextStyle(fontSize: 20.0, color: Colors.black),
child: Stack(
fit: StackFit.passthrough,
children: const [
Align(
alignment: Alignment(-0.5, -0.5),
child: Text("-0.5, -0.5"),
),
Align(
alignment: Alignment(-0.5, 0.5),
child: Text("-0.5, 0.5"),
),
Align(
alignment: Alignment(0.5, -0.5),
child: Text("0.5, -0.5"),
),
Align(alignment: Alignment.topLeft, child: Text("topLeft")),
Align(
alignment: Alignment(0.5, 0.5),
child: Text("0.5, 0.5"),
),
Align(alignment: Alignment.topCenter, child: Text("topCenter")),
Align(alignment: Alignment.topRight, child: Text("topRight")),
Align(alignment: Alignment.centerLeft, child: Text("centerLeft")),
Align(alignment: Alignment.center, child: Text("center")),
Align(
alignment: Alignment.centerRight, child: Text("centerRight")),
Align(alignment: Alignment.bottomLeft, child: Text("bottomLeft")),
Align(
alignment: Alignment.bottomCenter,
child: Text("bottomCenter")),
Align(
alignment: Alignment.bottomRight, child: Text("bottomRight")),
],
),
));
}
}