Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vkalvakuntala opened this issue Dec 9, 2021 · 0 comments
Open

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

vkalvakuntala opened this issue Dec 9, 2021 · 0 comments

Comments

@vkalvakuntala
Copy link

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,
);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant