Multi Platform
Multi Platform
PEMROGRAMAN MULTIPLATFORM
Disusun Oleh :
Dosen Pengampu:
Depandi Enda, M.Kom., S.ST.
Kode flutter
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Kalkulator UTS',
theme: ThemeData(
fontFamily: 'PlayfairDisplay',
primarySwatch: Colors.green,
useMaterial3: false,
),
debugShowCheckedModeBanner: false,
home: const KalkulatorUTS(),
);
}
}
@override
State<KalkulatorUTS> createState() =>
_KalkulatorUTSState();
}
return Scaffold(
backgroundColor: const Color.fromARGB(255, 255, 255,
255),
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: AppBar(
backgroundColor: const Color.fromARGB(255, 255,
255, 255),
elevation: 0,
centerTitle: true,
title: const Text(
'KALKULATOR UTS',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
bottom: const PreferredSize(
preferredSize: Size.fromHeight(2),
child: Divider(
color: Color.fromARGB(255, 24, 143, 1),
height: 2,
thickness: 2,
),
),
),
),
body: LayoutBuilder(
builder: (context, constraints) {
return SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
_buildInputField('Nilai 1', controller1),
Kode flutter
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Login App',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(borderRadius:
BorderRadius.circular(4)),
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 12,
),
),
),
home: const LoginScreen(),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(70),
child: AppBar(
backgroundColor: const Color.fromARGB(255, 255,
174, 231),
elevation: 0,
centerTitle: true,
title: const Text(
'LOGIN',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 40,
),
),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(2),
child: Container(color: Colors.black, height:
2),
),
),
),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 50),
// Gambar profil
Container(
width: 150,
height: 150,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: const Color.fromARGB(255, 190,
1, 1),
width: 2,
),
image: const DecorationImage(
image:
AssetImage('images/user2.png'),
fit: BoxFit.cover,
),
),
),
const SizedBox(height: 100),
// Username Row
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
const Text('Username', style:
TextStyle(fontSize: 16)),
const SizedBox(width: 16),
Expanded(
child: TextField(
decoration: const
InputDecoration(hintText: ''),
),
),
],
),
const SizedBox(height: 16),
// Password Row
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
const Text('Password', style:
TextStyle(fontSize: 16)),
const SizedBox(width: 22),
Expanded(
child: TextField(
obscureText: true,
decoration: const
InputDecoration(hintText: ''),
),
),
],
),
const SizedBox(height: 16),
// Tombol Submit
ElevatedButton(
onPressed: () {
// Login handler
},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
vertical: 16,
horizontal: 48,
),
backgroundColor: const
Color.fromARGB(255, 255, 174, 231),
foregroundColor: Colors.black,
side: const BorderSide(color:
Colors.black),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(4),
),
),
child: const Text('Submit'),
),
],
),
),
),
);
}
}
Tampilan Hasil Running