Untitled
user_8125782
dart
10 months ago
3.4 kB
4
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Demo Flutter',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: const Color.fromARGB(255, 85, 19, 184)),
useMaterial3: true,
),
home: const MyHomePage(title: 'Belajar Flutter'),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Scaffold(
appBar: AppBar(
backgroundColor: colorScheme.inversePrimary,
title: Text(title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
padding: const EdgeInsets.all(16.0),
margin: const EdgeInsets.only(top: 10.0),
color: Colors.black,
child: const Text(
'Belajar Flutter',
style: TextStyle(fontSize: 24, color: Colors.white),
textAlign: TextAlign.center,
),
),
Container(
padding: const EdgeInsets.all(16.0),
margin: const EdgeInsets.only(top: 10.0),
color: colorScheme.primary,
child: const Text(
'Dika',
style: TextStyle(fontSize: 24, color: Colors.white),
textAlign: TextAlign.center,
),
),
Container(
padding: const EdgeInsets.all(16.0),
margin: const EdgeInsets.only(top: 10.0),
color: colorScheme.secondary,
child: const Text(
'JEJE',
style: TextStyle(fontSize: 24, color: Colors.white),
textAlign: TextAlign.center,
),
),
Container(
padding: const EdgeInsets.all(16.0),
margin: const EdgeInsets.only(top: 10.0),
color: colorScheme.tertiary,
child: const Text(
'Rizal',
style: TextStyle(fontSize: 24, color: Colors.black),
textAlign: TextAlign.center,
),
),
Container(
padding: const EdgeInsets.all(16.0),
margin: const EdgeInsets.only(top: 10.0),
color: colorScheme.surface,
child: const Text(
'Faisal',
style: TextStyle(fontSize: 24, color: Colors.white),
textAlign: TextAlign.center,
),
),
Container(
padding: const EdgeInsets.all(16.0),
margin: const EdgeInsets.only(top: 10.0),
color: colorScheme.background,
child: const Text(
'Firus',
style: TextStyle(fontSize: 24, color: Colors.white),
textAlign: TextAlign.center,
),
),
],
),
),
);
}
}Editor is loading...
Leave a Comment