SHARE
TWEET

Untitled

a guest Nov 19th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2.  
  3. class SignInScreen extends StatefulWidget {
  4.   @override
  5.   _SignInScreenState createState() => _SignInScreenState();
  6. }
  7.  
  8. class _SignInScreenState extends State<SignInScreen> {
  9.  
  10.   PageStatus pageStatus = PageStatus.signingIn;
  11.  
  12.   @override
  13.   Widget build(BuildContext context) {
  14.     return pageStatus == PageStatus.signingIn ? SignInPage(this.updateStatus) : CreateNewPage(this.updateStatus);
  15.   }
  16.  
  17.   void updateStatus(PageStatus newStatus) {
  18.     setState(() {
  19.       pageStatus = newStatus;
  20.     });
  21.   }
  22. }
  23.  
  24.  
  25.  
  26.  
  27. enum PageStatus {
  28.   signingIn,
  29.   creatingNew
  30. }
  31.  
  32.  
  33. class SignInPage extends StatelessWidget {
  34.   SignInPage(this.updatePageStatus);
  35.  
  36.   final Function updatePageStatus;
  37.  
  38.   @override
  39.   Widget build(BuildContext context) {
  40.     return Container();
  41.   }
  42. }
  43.  
  44. class CreateNewPage extends StatelessWidget {
  45.   CreateNewPage(this.updatePageStatus);
  46.  
  47.   final Function updatePageStatus;
  48.  
  49.   @override
  50.   Widget build(BuildContext context) {
  51.     return Container();
  52.   }
  53. }
RAW Paste Data
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
 
Top