Skip to content

Instantly share code, notes, and snippets.

@RyouMon
Created November 20, 2022 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyouMon/0d37c2d6248842ccb6430147f4d46e32 to your computer and use it in GitHub Desktop.
Save RyouMon/0d37c2d6248842ccb6430147f4d46e32 to your computer and use it in GitHub Desktop.
Flutter: Align Example
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Container(
height: 120.0,
width: 120.0,
color: Colors.blue.shade50,
child: const Align(
alignment: Alignment.topRight,
child: FlutterLogo(size: 60),
)));
}
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Align Example'),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment