Hommie
  • Introduction
  • Getting Started
  • The App
    • Directory Structure
    • Adding Screens
  • Others
    • License
Powered by GitBook
On this page
  • Creating Screen Files
  • Updating Route

Was this helpful?

  1. The App

Adding Screens

Creating Screen Files

Adding a new screen can be done in a couple of steps

  • Create a new folder, say new_screen and place it under /lib/views/ .

  • Create a new file new_screen.dart within this folder.

class NewScreen extends StatelessWidget {
    . . .
    . . .
}

Updating Route

  • Open the file /lib/router.dart

  • importnewly created Screen into the Router

import 'package:appname/views/new_screen/new_screen.dart';

const String newScreen = 'new_screen';

Route<dynamic> generateRoute(RouteSettings settings) {
  switch (settings.name) {
   case newScreen:
      return MaterialPageRoute(builder: (_) => NewScreen());
  }
PreviousDirectory StructureNextLicense

Last updated 4 years ago

Was this helpful?