voyagehandbook/lib/util/widgets/warning.dart

61 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
/*
Voyage Handbook - The open-source WikiVoyage reader
Copyright (C) 2023 Matyáš Caras
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class Warning extends StatelessWidget {
const Warning({super.key, required this.content});
final List<InlineSpan> content;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border.all(
color:
(MediaQuery.of(context).platformBrightness == Brightness.light)
? const Color.fromARGB(255, 151, 141, 48)
: Colors.yellow,
width: 2),
borderRadius: BorderRadius.circular(8),
color: (MediaQuery.of(context).platformBrightness == Brightness.dark)
? const Color.fromARGB(255, 151, 141, 48)
: Colors.yellow,
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
children: [
const Icon(
Icons.warning,
size: 50,
),
const SizedBox(
width: 10,
),
Flexible(
child: RichText(
text: TextSpan(children: content),
),
)
],
),
),
);
}
}