mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:flutter/material.dart';
 | |
| import 'package:go_router/go_router.dart';
 | |
| 
 | |
| /// Widget for the root/initial pages in the bottom navigation bar.
 | |
| class RootPlaceholderScreen extends StatelessWidget {
 | |
|   /// Creates a RootScreen
 | |
|   const RootPlaceholderScreen({
 | |
|     required this.label,
 | |
|     required this.detailsPath,
 | |
|     this.secondDetailsPath,
 | |
|     super.key,
 | |
|   });
 | |
| 
 | |
|   /// The label
 | |
|   final String label;
 | |
| 
 | |
|   /// The path to the detail page
 | |
|   final String detailsPath;
 | |
| 
 | |
|   /// The path to another detail page
 | |
|   final String? secondDetailsPath;
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     return Scaffold(
 | |
|       appBar: AppBar(
 | |
|         title: Text('Root of section $label'),
 | |
|       ),
 | |
|       body: Center(
 | |
|         child: Column(
 | |
|           mainAxisSize: MainAxisSize.min,
 | |
|           children: <Widget>[
 | |
|             Text('$label Page', style: Theme.of(context).textTheme.titleLarge),
 | |
|             const Padding(padding: EdgeInsets.all(4)),
 | |
|             TextButton(
 | |
|               onPressed: () {
 | |
|                 context.go(detailsPath, extra: '$label-XYZ');
 | |
|               },
 | |
|               child: const Text('View details'),
 | |
|             ),
 | |
|             const Padding(padding: EdgeInsets.all(4)),
 | |
|             if (secondDetailsPath != null)
 | |
|               TextButton(
 | |
|                 onPressed: () {
 | |
|                   context.go(secondDetailsPath!);
 | |
|                 },
 | |
|                 child: const Text('View more details'),
 | |
|               ),
 | |
|           ],
 | |
|         ),
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 | 
