3-1.(p.25)lib/sign_in_screen.dart


lib/sign_in_screen

import 'package:flutter/material.dart';
import 'package:photoapp/photo_list_screen.dart';

// ...

class _SignInScreenState extends State<SignInScreen> {
  // ...

  void _onSignIn() {
    if (_formKey.currentState?.validate() != true) {
      return;
    }

    // 画像一覧画面に切り替え
    Navigator.of(context).pushReplacement(
      MaterialPageRoute(
        builder: (_) => PhotoListScreen(),
      ),
    );
  }

  void _onSignUp() {
    if (_formKey.currentState?.validate() != true) {
      return;
    }

    // 画像一覧画面に切り替え
    Navigator.of(context).pushReplacement(
      MaterialPageRoute(
        builder: (_) => PhotoListScreen(),
      ),
    );
  }
}