当前位置:网站首页>Build a short video platform and copy a demo of the login interface

Build a short video platform and copy a demo of the login interface

2022-04-21 17:57:00 Cloudleopard network technology

Construction of short video platform , Copy a login interface demo
Program running root directory

import 'dart:ui';

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

void main() {
    
  runApp(MyApp());
}

///  root directory  Activity ViewController
class MyApp extends StatelessWidget {
    
  @override
  Widget build(BuildContext context) {
    
    return const MaterialApp(
      home: MyHomePage(),
    );
  }

Default home page

/// Load the displayed homepage by default 
class MyHomePage extends StatefulWidget {
    
  const MyHomePage({
    Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
    
  /// The user name uses 
  late final TextEditingController _nameController = TextEditingController();
  /// The password input box uses 
  late final TextEditingController _passwordController =
      TextEditingController();

  @override
  Widget build(BuildContext context) {
    
    return Scaffold(
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: Stack(
          children: [
            // first floor   Background image 
            buildFunction1(),
            // The second floor   Gaussian blur 
            buildFunction2(),
            // The third level   Login input layer 
            buildFunction3(),
          ],
        ),
      ),
    );
  }
... ...  Here is the corresponding method block 
}

A background image of

  buildFunction1() {
    
    return Positioned.fill(
      child: Image.asset(
        "images/loginbg.png",
        fit: BoxFit.fill,
      ),
    );
  }

Gaussian blur

  buildFunction2() {
    
    return Positioned.fill(
      child: BackdropFilter(
        filter: ImageFilter.blur(sigmaX: 3, sigmaY: 3),
        child: Container(
          color: Colors.white.withOpacity(0.4),
        ),
      ),
    );
  }

Login input layer

buildFunction3() {
    
    return Positioned.fill(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          SizedBox(
            width: 300,
            child: TextField(
              controller: _nameController,
              decoration: const InputDecoration(
                hintText: " Please enter a user name ",
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.all(Radius.circular(33)),
                  borderSide: BorderSide(
                    color: Colors.grey,
                  ),
                ),
              ),
            ),
          ),
          const SizedBox(height: 20),
          SizedBox(
            width: 300,
            child: TextField(
              controller: _passwordController,
              decoration: const InputDecoration(
                hintText: " Please input a password ",
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.all(Radius.circular(33)),
                  borderSide: BorderSide(
                    color: Colors.grey,
                  ),
                ),
              ),
            ),
          ),
          const SizedBox(height: 40),
          SizedBox(
            width: 300,
            height: 48,
            child: ClipRRect(
              borderRadius: const BorderRadius.all(Radius.circular(33)),
              child: ElevatedButton(
                onPressed: () {
    
                  String name = _nameController.text;
                  String password = _passwordController.text;

                  print(" The content obtained is  $name $password");
                },
                child: const Text(" Sign in "),
              ),
            ),
          )
        ],
      ),
    );
  }

That's all Construction of short video platform , Copy a login interface demo, More content welcome to follow the article

版权声明
本文为[Cloudleopard network technology]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211731001982.html