yubioath-flutter/lib/app/views/message_page.dart

69 lines
2.0 KiB
Dart
Raw Normal View History

2022-10-04 13:12:54 +03:00
/*
* Copyright (C) 2022 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:flutter/material.dart';
import 'app_page.dart';
class MessagePage extends StatelessWidget {
final Widget? title;
2022-05-20 12:11:20 +03:00
final Widget? graphic;
final String? header;
2022-05-18 15:11:17 +03:00
final String? message;
2022-05-20 14:00:07 +03:00
final List<Widget> actions;
final bool delayedContent;
final Widget Function(BuildContext context)? keyActionsBuilder;
final Widget Function(BuildContext context)? actionButtonBuilder;
const MessagePage({
2022-05-12 10:56:55 +03:00
super.key,
this.title,
2022-05-20 12:11:20 +03:00
this.graphic,
this.header,
2022-05-18 15:11:17 +03:00
this.message,
2022-05-20 12:11:20 +03:00
this.actions = const [],
this.keyActionsBuilder,
2022-09-13 13:55:17 +03:00
this.actionButtonBuilder,
this.delayedContent = false,
2022-05-12 10:56:55 +03:00
});
@override
Widget build(BuildContext context) => AppPage(
title: title,
centered: true,
2022-05-20 12:11:20 +03:00
actions: actions,
keyActionsBuilder: keyActionsBuilder,
2022-09-13 13:55:17 +03:00
actionButtonBuilder: actionButtonBuilder,
delayedContent: delayedContent,
2022-05-20 12:11:20 +03:00
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
if (graphic != null) graphic!,
if (header != null)
Text(header!,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 12.0),
if (message != null) ...[
Text(message!, textAlign: TextAlign.center),
],
2022-05-18 15:11:17 +03:00
],
2022-05-20 12:11:20 +03:00
),
),
);
}