The following _TypeError was thrown building
BlurImagePageScaffold(dirty): type 'List' is not a subtype of type 'Widget'
I'm getting above error when Im trying to run my code. I have included my codes files below. how to solve this.
blur_image_page_scaffold.dart
import 'dart:ui';
import 'package:flutter/material.dart';
class BlurImagePageScaffold extends StatelessWidget {
const BlurImagePageScaffold({Key? key,this.imagePath, this.body}) : super(key: key);
final body;
final imagePath;
@override
Widget build(BuildContext context) {
return Container(
height: double.infinity,
width: double.infinity,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: AssetImage(imagePath),fit: BoxFit.fill),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX:10, sigmaY:10),
child: Container(
color: Colors.black.withOpacity(0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
body
],
)
),
),
);
}
}
hello.dart
import 'package:flutter/material.dart';
import 'package:new_chat_app/components/blur_image_page_scaffold.dart';
import 'package:new_chat_app/components/lets_start.dart';
import 'package:new_chat_app/components/logo.dart';
import 'package:new_chat_app/components/terms_and_conditions.dart';
class Hello extends StatelessWidget {
const Hello({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlurImagePageScaffold(imagePath: 'images/bg.jpg', body: [
Logo(),
Column(
children: [
Text('Hello'),
Column(
children: [
Text("Whatsapp is a Cross-Platform"),
Text("mobile messaging with friends"),
Text("all over the world"),
],
),
TermsAndConditions(),
LetsStart(),
],
),
]);
}
}
CodePudding user response:
Simply set children to body
Like so:
BackdropFilter(
filter: ImageFilter.blur(sigmaX:10, sigmaY:10),
child: Container(
color: Colors.black.withOpacity(0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: body,
)
),
),
)
