Skip to main content

simple login with flutter


  • main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    SystemChrome.setEnabledSystemUIOverlays([]);
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: double.maxFinite,
        height: double.maxFinite,
        child: Stack(
          children: <Widget>[
            Image.asset(
              "images/cover.png",
              width: double.maxFinite,
            ),
            Positioned(
              top: 150,
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: 35),
                child: Text('Sign In',
                style: TextStyle(
                  fontSize: 20,
                  fontWeight: FontWeight.bold,
                  color: Colors.purple,
                ),
                ),

                ),
            ),
            Positioned(
              top: 180,
              child: Container(
                padding: EdgeInsets.symmetric(vertical: 20, horizontal: 18),
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.height,
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(32),
                        topRight: Radius.circular(32))),
                child: Column(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.only(top: 20.0),
                      child: TextField(
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          hintText: 'Username',
                          prefixIcon: const Icon(
                            Icons.person,
                            color: Colors.purple,
                          ),
                        ),
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 16),
                      child: TextField(
                        decoration: InputDecoration(
                            border: InputBorder.none,
                            hintText: 'Password',
                            prefixIcon: const Icon(
                              Icons.lock,
                              color: Colors.purple,
                            )),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 20),
                      height: 50,
                      width: double.maxFinite,
                      decoration: BoxDecoration(
                          color: Colors.purple.shade300,
                          borderRadius: BorderRadius.all(Radius.circular(32))),
                      child: Center(
                        child: Text(
                          'LOGIN',
                          style: TextStyle(color: Colors.white, fontSize: 20),
                        ),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 15),
                      child: Center(
                        child: Text(
                          'Forgot Password',
                          style: TextStyle(fontSize: 15, color: Colors.grey),
                        ),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 20),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          Container(
                            width: 50,
                            height: 50,
                            decoration: BoxDecoration(
                              color: Colors.purple.shade300,
                              borderRadius:
                                  BorderRadius.all(Radius.circular(50)),
                            ),
                            child: Center(
                                child: Icon(Icons.face, color: Colors.white)),
                          ),
                          Container(
                            width: 40,
                          ),
                          Container(
                            width: 50,
                            height: 50,
                            decoration: BoxDecoration(
                              color: Colors.purple.shade300,
                              borderRadius:
                                  BorderRadius.all(Radius.circular(50)),
                            ),
                            child: Center(
                                child: Icon(Icons.fingerprint,
                                    color: Colors.white)),
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}

  • pubspec.yaml
name: simple_ui_login
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
   - images/cover.png
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

  • result

Popular posts from this blog

menggunakan API blogspot di gridsome vue js

yuk berbagi lagi sesuai dengan judul artikel ini, kali ini saya akan berbagi tentang bagaimana cara menggunakan API blogspot, dan menggunakan data dari API blogspot tersebut di aplikasi yang kita buat menggunakan gridsome.

error source-filesystem saat upgrade gridsome

assalamualaikum halo semuanya kali ini ane mau share sedikit error pada saat ane upgrade gridsome versi 0.4 ke versi 0.6. awalnya sih setelah beberapa minggu nggak update tulisan, ada inisiatif untuk membuka website official gridsome dan ternyata untuk latest version sudah sudah versi 0.6, hmm ugrade ah. untuk temen" yang ingin upgrade gridsome tinggal menjalani perintah seperti ini mengunakan yarn  yarn upgrade gridsome --latest mengunakan npm   npm install gridsome@latest setelah menjalankan perintah tersebut makan otomatis akan mengupgrade versi gridsome ke versi yang terbaru. nah setelah ini juga akan mucul beberapa error salah satunya yaitu perubahan query graphql  coverImage menjadi cover-image. yang terakhir adalah akan terjadi error di library filesystem gridsome, untuk mengatasi error ini silah teman" tinggal upgrade source-filesystem gridsome seperti ini: " @gridsome/source-filesystem " : " ^0. 3 .0 " , " @gridsome/s...
Iran Buka Blokir Akses Gmail Teheran - Setelah sempat memblokirnya, Iran membuka kembali akses Gmail. Namun Komite Sensor Internet Iran menyebutkan, sensor tambahan tengah dipersiapkan untuk menyaring konten YouTube. Laporan yang dilansir AFP dan dikutip detikINET, Senin (1/10/2012), para pengguna internet di Iran melaporkan telah bisa kembali mengakses akun Gmail mereka sejak diblokir pada 24 September. Pencarian Google versi secure atau HTTPS pun sudah bisa diakses setelah diblokir pada waktu yang sama. Sementara itu, pencarian Google versi unsecure atau HTTP tidak pernah diblokir. Pekan lalu, sekretaris lembaga pengawasan konten nasional Iran Abdolsamad Khoramabadi mengatakan, Google dan Gmail akan disaring hingga ada pemberitahuan lebih lanjut. Namun Mohammad Reza Miri, anggota komite kementerian telekomunikasi Iran mengatakan blokir Gmail merupakan akibat tidak disengaja dari upaya menerapkan sensor pada YouTube.  "Sayangnya, kami belum memiliki pe...