2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-05-09 16:59:55 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
2022-11-25 19:24:01 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-05-09 16:59:55 +00:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2022-11-25 19:24:01 +00:00
|
|
|
import 'package:flutter_svg/svg.dart';
|
2023-05-09 21:57:40 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
2023-05-09 16:59:55 +00:00
|
|
|
import 'package:stackwallet/themes/theme_providers.dart';
|
2022-11-25 19:24:01 +00:00
|
|
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
|
|
|
|
2023-05-09 16:59:55 +00:00
|
|
|
class Background extends ConsumerWidget {
|
2022-11-25 19:24:01 +00:00
|
|
|
const Background({
|
|
|
|
Key? key,
|
|
|
|
required this.child,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final Widget child;
|
|
|
|
|
|
|
|
@override
|
2023-05-09 16:59:55 +00:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-11-25 19:24:01 +00:00
|
|
|
Color? color;
|
|
|
|
|
2023-01-24 18:17:36 +00:00
|
|
|
bool shouldPad = false;
|
|
|
|
|
2023-05-09 16:59:55 +00:00
|
|
|
switch (Theme.of(context).extension<StackColors>()!.themeId) {
|
|
|
|
case "ocean_breeze":
|
2023-01-24 18:17:36 +00:00
|
|
|
shouldPad = true;
|
|
|
|
color = null;
|
|
|
|
break;
|
2023-05-09 16:59:55 +00:00
|
|
|
case "fruit_sorbet":
|
2022-11-25 19:24:01 +00:00
|
|
|
color = null;
|
|
|
|
break;
|
2023-03-17 18:56:40 +00:00
|
|
|
default:
|
|
|
|
color = Theme.of(context).extension<StackColors>()!.background;
|
|
|
|
break;
|
2022-11-25 19:24:01 +00:00
|
|
|
}
|
|
|
|
|
2023-05-09 16:59:55 +00:00
|
|
|
final bgAsset = ref.watch(
|
|
|
|
themeProvider.select(
|
|
|
|
(value) => value.assets.background,
|
|
|
|
),
|
|
|
|
);
|
2022-11-25 19:24:01 +00:00
|
|
|
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: color,
|
|
|
|
gradient:
|
|
|
|
Theme.of(context).extension<StackColors>()!.gradientBackground,
|
|
|
|
),
|
|
|
|
child: ConditionalParent(
|
|
|
|
condition: bgAsset != null,
|
|
|
|
builder: (child) => Stack(
|
|
|
|
children: [
|
|
|
|
Positioned.fill(
|
|
|
|
child: Padding(
|
2023-01-24 18:17:36 +00:00
|
|
|
padding: shouldPad
|
|
|
|
? EdgeInsets.only(
|
|
|
|
top: MediaQuery.of(context).size.height * (1 / 8),
|
|
|
|
bottom: MediaQuery.of(context).size.height * (1 / 12),
|
|
|
|
)
|
|
|
|
: const EdgeInsets.all(0),
|
2023-05-09 16:59:55 +00:00
|
|
|
child: SvgPicture.file(
|
|
|
|
File(
|
|
|
|
bgAsset!,
|
|
|
|
),
|
2022-11-25 19:24:01 +00:00
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned.fill(
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|