0% found this document useful (0 votes)
15 views5 pages

Tugas 1&2 MobileTeori4 Onis - Alamsyah - 2201010222

Uploaded by

Onis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Tugas 1&2 MobileTeori4 Onis - Alamsyah - 2201010222

Uploaded by

Onis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Nama : Onis Alamsyah

Nim : 2201010222
Kelas : D
TUGAS 1
import 'package:flutter/material.dart';

class RowExample extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Row Tugas 1"),
),
body: Padding(
padding: const EdgeInsets.only(top: 20),
child: Row(
children: <Widget>[
Container(
color: Colors.blue,
height: 100,
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Kolom 1', style: TextStyle(color: Colors.white)),
],
),
),
Container(
color: Colors.yellow,
height: 100,
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Kolom 2', style: TextStyle(color: Colors.white)),
],
),
),
Container(
color: Colors.green,
height: 100,
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Kolom 3', style: TextStyle(color: Colors.white)),
],
),
),
],
),
),
);
}
}

TUGAS 2
import 'package:flutter/material.dart';

void main() {
runApp(MaterialApp(
home: WidgetExample(),
));
}

class WidgetExample extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Widget'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Wrap Widget Example
Wrap(
spacing: 8.0,
runSpacing: 8.0,
children: List.generate(
12,
(index) => Container(
padding: EdgeInsets.all(8.0),
color: Color.fromARGB(255, 236, 240, 7),
child: Container(
height: 100,
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Wrap Widget $index', style: TextStyle(color:
Colors.white)),
],
)),
),
),
),
SizedBox(height: 16.0),

// Expand Widget Example


Expanded(
child: Container(
color: Color.fromARGB(255, 186, 226, 53),
child: Center(
child: Text(
'Expanded Widget',
style: TextStyle(color: Colors.white),
),
),
),
),
SizedBox(height: 16.0),

// Stack Widget Example


Stack(
alignment: Alignment.center,
children: [
Positioned(
child: Container(
width: 200,
height: 200,
color: Color.fromARGB(255, 113, 170, 15),
),
),
Positioned(
child: Container(
width: 150,
height: 150,
color: Color.fromARGB(255, 124, 202, 64),
),
),
Positioned(
child: Container(
width: 100,
height: 100,
color: Color.fromARGB(255, 207, 250, 120),
),
),
Positioned(
child: Text(
'Stack Widget',
style: TextStyle(color: Colors.white),
),
),
],
),
],
),
),
);
}
}

You might also like