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

66 lines
1.9 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;
2022-07-07 21:20:04 +03:00
final List<PopupMenuEntry> keyActions;
2022-09-13 13:55:17 +03:00
final Widget Function(List<PopupMenuEntry> keyActions)? 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 [],
2022-07-07 21:20:04 +03:00
this.keyActions = const [],
2022-09-13 13:55:17 +03:00
this.actionButtonBuilder,
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,
2022-07-07 21:20:04 +03:00
keyActions: keyActions,
2022-09-13 13:55:17 +03:00
actionButtonBuilder: actionButtonBuilder,
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
),
),
);
}