1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00
Files
samples/rolodex/lib/main.dart
Mitchell Goodwin c787dd01a7 [Rolodex] Update fidelity of Contact list screens (#2588)
This PR:

- Updates the fidelity of the home screen and contact list screens to near full fidelity
- Renames "Contact Lists" to "Contact Groups". We have multiple collections of contacts, so having lists of lists felt confusing
- Adds more functionality to the data models

Comparison of the two screens against native:

| Native | Flutter |
| --- | --- |
| <img width="418" alt="Screenshot 2025-02-19 at 2 59 58 PM" src="https://github.com/user-attachments/assets/1cc53d19-6bb5-4782-82fa-1a62cd75fd51" /> | <img width="397" alt="Screenshot 2025-02-19 at 2 58 54 PM" src="https://github.com/user-attachments/assets/ddab75f2-4aec-4239-a736-690a3185c196" /> |
| <img width="409" alt="Screenshot 2025-02-19 at 2 59 41 PM" src="https://github.com/user-attachments/assets/ee0d81ee-ae60-47ad-b071-266f39ce9b70" /> | <img width="402" alt="Screenshot 2025-02-19 at 2 58 45 PM" src="https://github.com/user-attachments/assets/88bf22f9-d8bd-40d7-a9ca-f2ded439de6c" /> |

Notably the container widget on the first screen is a placeholder, until a Cupertino collapsable widget is made.
2025-02-24 18:06:50 +00:00

60 lines
1.6 KiB
Dart

// 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_group.dart';
import 'screens/contacts.dart';
import 'screens/contact_groups.dart';
void main() {
runApp(const RolodexApp());
}
class RolodexApp extends StatelessWidget {
const RolodexApp({super.key});
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => ContactGroupsModel(),
child: CupertinoApp(
title: 'Rolodex',
theme: CupertinoThemeData(
barBackgroundColor: CupertinoDynamicColor.withBrightness(
color: Color(0xFFF9F9F9),
darkColor: Color(0xFF1D1D1D),
),
),
initialRoute: '/contacts',
onGenerateInitialRoutes: (initialRoute) {
return [
CupertinoPageRoute(
title: 'Lists',
builder: (BuildContext context) {
return ContactGroupsPage();
},
),
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')),
);
},
);
},
),
);
}
}