mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
54 lines
1.4 KiB
// Copyright 2018 The Flutter team. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'data/contact_list.dart';
|
|
import 'screens/contacts.dart';
|
|
import 'screens/lists.dart';
|
|
|
|
void main() {
|
|
runApp(const RolodexApp());
|
|
}
|
|
|
|
class RolodexApp extends StatelessWidget {
|
|
const RolodexApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ChangeNotifierProvider(
|
|
create: (context) => ContactListsModel(),
|
|
child: CupertinoApp(
|
|
title: 'Rolodex',
|
|
initialRoute: '/contacts',
|
|
onGenerateInitialRoutes: (initialRoute) {
|
|
return [
|
|
CupertinoPageRoute(
|
|
title: 'Lists',
|
|
builder: (BuildContext context) {
|
|
return ListsPage();
|
|
},
|
|
),
|
|
CupertinoPageRoute(
|
|
builder: (BuildContext context) {
|
|
return ContactListsPage(listId: 0);
|
|
},
|
|
),
|
|
];
|
|
},
|
|
onUnknownRoute: (RouteSettings settings) {
|
|
return CupertinoPageRoute(
|
|
builder: (BuildContext context) {
|
|
return const CupertinoPageScaffold(
|
|
child: Center(child: Text('Unknown Route')),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|