febryardiansyah/manga_mint

4 positional argument(s) expected, but 0 found.

vkalvakuntala opened this issue · 0 comments

Hi, I'm just learning flutter and unable to resolve an error. can someone please help me in resolving this issue. Error coming at "SignInButton (" 4 positional argument(s) expected, but 0 found. (Documentation) Try adding the missing arguments. Please find my code below.

import 'package:flutter/material.dart';
import 'package:signin1/app/sign_in/sign_in_button.dart';
import 'package:signin1/common_widgets/custom_raised_button.dart';

class SignInPage extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Time Tracker'),
elevation: 2.0,
),
body: _buildContent(),
backgroundColor: Colors.grey[200],
);
}

Widget _buildContent() {
return Padding(
padding: EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Sign in',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 32.0, fontWeight: FontWeight.w600),
),
SizedBox(height: 8.0),
SignInButton (
text: 'sign in',
textColor: Colors.black87,
color: Colors.white,
onPressed: (){},
),
],
));
}
}

import 'package:flutter/material.dart';

class CustomRaisedButton extends StatelessWidget {
CustomRaisedButton({
required this.child,
required this.color,
this.borderRadius = 2.0,
required this.onPressed,
});
final Widget child;
final Color color;
final double borderRadius;
final VoidCallback onPressed;

@OverRide
Widget build(BuildContext context) {
return SizedBox(
child: ElevatedButton(
child: child,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(color),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius),
))),
onPressed: onPressed,
),
);
}
}
import 'package:flutter/material.dart';
import 'package:signin1/common_widgets/custom_raised_button.dart';

class SignInButton extends CustomRaisedButton {
SignInButton(
String text,
Color color,
Color textColor,
VoidCallback onPressed,

) : super(
child: Text(
text,
style: TextStyle(color: textColor, fontSize: 15.0),
),
color: color,
borderRadius: 8.0,
onPressed: onPressed,
);
}