mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-14 04:33:16 +00:00
dd81053f42
rewrote OnboardingPage: * decomposed into separate widgets * now content stays centered on wide screens (set so width won't expand further than 480px) * pageController is now properly disposed * added some more code changes to * main (error widget builder) * brand_header (centerTitle instead of empty actions list) * console_page (listener callback fix, used gaps instead of SizedBox'es, added keys to list items) * service_page (just cleaner build method) * removed some dead code Co-authored-by: Aliaksei Tratseuski <aliaksei.tratseuski@gmail.com> Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/444 Co-authored-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org> Co-committed-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
69 lines
1.8 KiB
Dart
69 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class BrandButton {
|
|
static ConstrainedBox rised({
|
|
required final VoidCallback? onPressed,
|
|
final Key? key,
|
|
final String? text,
|
|
final Widget? child,
|
|
}) {
|
|
assert((text ?? child) != null, 'either title or child must not be empty');
|
|
assert(text != null || child != null, 'title or child must be provided');
|
|
|
|
return ConstrainedBox(
|
|
constraints: const BoxConstraints(
|
|
minHeight: 48,
|
|
minWidth: double.infinity,
|
|
),
|
|
child: FilledButton(
|
|
key: key,
|
|
onPressed: onPressed,
|
|
child: child ?? Text(text ?? ''),
|
|
),
|
|
);
|
|
}
|
|
|
|
static ConstrainedBox filled({
|
|
required final VoidCallback? onPressed,
|
|
final Key? key,
|
|
final String? text,
|
|
final Widget? child,
|
|
}) {
|
|
assert((text ?? child) != null, 'either title or child must not be empty');
|
|
assert(text != null || child != null, 'title or child must be provided');
|
|
|
|
return ConstrainedBox(
|
|
constraints: const BoxConstraints(
|
|
minWidth: double.infinity,
|
|
),
|
|
child: FilledButton(
|
|
key: key,
|
|
onPressed: onPressed,
|
|
style: ElevatedButton.styleFrom(
|
|
tapTargetSize: MaterialTapTargetSize.padded,
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
),
|
|
child: child ??
|
|
Text(
|
|
text ?? '',
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
static ConstrainedBox text({
|
|
required final VoidCallback onPressed,
|
|
required final String title,
|
|
final Key? key,
|
|
}) =>
|
|
ConstrainedBox(
|
|
constraints: const BoxConstraints(
|
|
minHeight: 40,
|
|
minWidth: double.infinity,
|
|
),
|
|
child: TextButton(onPressed: onPressed, child: Text(title)),
|
|
);
|
|
}
|