CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 03:13:41 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=5b3c3b5e1860caec535232b996081ba0b21fb098ae4f4d9cffb1c9ea413833eaa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22T-H-RArz971DvM-9jiAPnqCvoxVaN3z3%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d36c36fa0c8e4d-BLR
belajar state - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() {
- runApp(const MyApp());
- }
- class MyApp extends StatelessWidget {
- const MyApp({super.key});
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
- ),
- home: MyHomePage(),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- const MyHomePage({super.key});
- @override
- State<MyHomePage> createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- String message = '';
- TextEditingController txtUsername = TextEditingController();
- TextEditingController txtPassword = TextEditingController();
- int rating = 0;
- void login() {
- // ambil username
- String user = txtUsername.text;
- // ambil password
- String pass = txtPassword.text;
- // cek jika username = 'admin' dan password = '1234' maka
- if (user == 'admin' && pass == '1234') {
- setState(() {
- message = 'Login Berhasil';
- });
- } else {
- setState(() {
- message = 'Login Gagal';
- });
- }
- // message = 'Login Berhasil'
- // selain itu message = 'Login Gagal'
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(title: Text('Belajar State')),
- body: Center(
- child: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- children: [
- TextFormField(
- decoration: InputDecoration(hintText: 'Username'),
- controller: txtUsername,
- ),
- TextFormField(
- decoration: InputDecoration(hintText: 'Password'),
- obscureText: true,
- controller: txtPassword,
- ),
- SizedBox(height: 20),
- MyButton(title: 'Login', icon: Icons.login, myFunction: login),
- MyButton(title: 'Register', icon: Icons.app_registration),
- SizedBox(height: 20),
- Text(message),
- Image.network(
- 'https://img.freepik.com/free-psd/modern-car-isolated_23-2151504546.jpg?semt=ais_incoming&w=740&q=80',
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: List.generate(5, (index) {
- return IconButton(
- onPressed: () {
- setState(() {
- rating = index + 1;
- });
- },
- icon: Icon(
- index < rating ? Icons.star : Icons.star_border_outlined,
- color: Colors.red,
- ),
- );
- }),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
- class MyButton extends StatelessWidget {
- String title;
- Function()? myFunction;
- IconData? icon;
- MyButton({super.key, required this.title, this.myFunction, this.icon});
- @override
- Widget build(BuildContext context) {
- return TextButton(
- onPressed: () {
- myFunction!.call();
- },
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Icon(icon, color: Colors.blue),
- Text(title, style: TextStyle(color: Colors.blue, fontSize: 20)),
- ],
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
📌 Swapzone +37% glitch ⭐ T
JavaScript | 14 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ X
JavaScript | 22 sec ago | 0.25 KB
-
✅⭐ Make huge profits on trading ⭐⭐ B
JavaScript | 25 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ X
JavaScript | 31 sec ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 35 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ S
JavaScript | 40 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ O
JavaScript | 44 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 7
JavaScript | 53 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand