mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-11-04 12:03:28 +00:00 
			
		
		
		
	[feat] Add actions to error widget. (#2865)
* chore: rebase error? * fix: revert changes in Cargo.toml * feat: add actions row
This commit is contained in:
		
							parent
							
								
									f914e7aa33
								
							
						
					
					
						commit
						2a2b5fe246
					
				@ -9,12 +9,14 @@ class FlowyErrorPage extends StatelessWidget {
 | 
				
			|||||||
    Error e, {
 | 
					    Error e, {
 | 
				
			||||||
    required String howToFix,
 | 
					    required String howToFix,
 | 
				
			||||||
    Key? key,
 | 
					    Key? key,
 | 
				
			||||||
 | 
					    List<Widget>? actions,
 | 
				
			||||||
  }) =>
 | 
					  }) =>
 | 
				
			||||||
      FlowyErrorPage._(
 | 
					      FlowyErrorPage._(
 | 
				
			||||||
        e.toString(),
 | 
					        e.toString(),
 | 
				
			||||||
        stackTrace: e.stackTrace?.toString(),
 | 
					        stackTrace: e.stackTrace?.toString(),
 | 
				
			||||||
        howToFix: howToFix,
 | 
					        howToFix: howToFix,
 | 
				
			||||||
        key: key,
 | 
					        key: key,
 | 
				
			||||||
 | 
					        actions: actions,
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  factory FlowyErrorPage.message(
 | 
					  factory FlowyErrorPage.message(
 | 
				
			||||||
@ -22,12 +24,14 @@ class FlowyErrorPage extends StatelessWidget {
 | 
				
			|||||||
    required String howToFix,
 | 
					    required String howToFix,
 | 
				
			||||||
    String? stackTrace,
 | 
					    String? stackTrace,
 | 
				
			||||||
    Key? key,
 | 
					    Key? key,
 | 
				
			||||||
 | 
					    List<Widget>? actions,
 | 
				
			||||||
  }) =>
 | 
					  }) =>
 | 
				
			||||||
      FlowyErrorPage._(
 | 
					      FlowyErrorPage._(
 | 
				
			||||||
        message,
 | 
					        message,
 | 
				
			||||||
        key: key,
 | 
					        key: key,
 | 
				
			||||||
        stackTrace: stackTrace,
 | 
					        stackTrace: stackTrace,
 | 
				
			||||||
        howToFix: howToFix,
 | 
					        howToFix: howToFix,
 | 
				
			||||||
 | 
					        actions: actions,
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  factory FlowyErrorPage.exception(
 | 
					  factory FlowyErrorPage.exception(
 | 
				
			||||||
@ -35,12 +39,14 @@ class FlowyErrorPage extends StatelessWidget {
 | 
				
			|||||||
    required String howToFix,
 | 
					    required String howToFix,
 | 
				
			||||||
    String? stackTrace,
 | 
					    String? stackTrace,
 | 
				
			||||||
    Key? key,
 | 
					    Key? key,
 | 
				
			||||||
 | 
					    List<Widget>? actions,
 | 
				
			||||||
  }) =>
 | 
					  }) =>
 | 
				
			||||||
      FlowyErrorPage._(
 | 
					      FlowyErrorPage._(
 | 
				
			||||||
        e.toString(),
 | 
					        e.toString(),
 | 
				
			||||||
        stackTrace: stackTrace,
 | 
					        stackTrace: stackTrace,
 | 
				
			||||||
        key: key,
 | 
					        key: key,
 | 
				
			||||||
        howToFix: howToFix,
 | 
					        howToFix: howToFix,
 | 
				
			||||||
 | 
					        actions: actions,
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const FlowyErrorPage._(
 | 
					  const FlowyErrorPage._(
 | 
				
			||||||
@ -48,14 +54,16 @@ class FlowyErrorPage extends StatelessWidget {
 | 
				
			|||||||
    required this.howToFix,
 | 
					    required this.howToFix,
 | 
				
			||||||
    this.stackTrace,
 | 
					    this.stackTrace,
 | 
				
			||||||
    super.key,
 | 
					    super.key,
 | 
				
			||||||
 | 
					    this.actions,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static const _titleFontSize = 24.0;
 | 
					  static const _titleFontSize = 24.0;
 | 
				
			||||||
  static const _titleToMessagePadding = 8.0;
 | 
					  static const _titleToMessagePadding = 8.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  final List<Widget>? actions;
 | 
				
			||||||
 | 
					  final String howToFix;
 | 
				
			||||||
  final String message;
 | 
					  final String message;
 | 
				
			||||||
  final String? stackTrace;
 | 
					  final String? stackTrace;
 | 
				
			||||||
  final String howToFix;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
@ -87,6 +95,11 @@ class FlowyErrorPage extends StatelessWidget {
 | 
				
			|||||||
            height: _titleToMessagePadding,
 | 
					            height: _titleToMessagePadding,
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
          if (stackTrace != null) StackTracePreview(stackTrace!),
 | 
					          if (stackTrace != null) StackTracePreview(stackTrace!),
 | 
				
			||||||
 | 
					          if (actions != null)
 | 
				
			||||||
 | 
					            Row(
 | 
				
			||||||
 | 
					              mainAxisAlignment: MainAxisAlignment.end,
 | 
				
			||||||
 | 
					              children: actions!,
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user