Skip to main content

Secondary

The [C2CSecondaryButton] widget is a versatile button widget for use in Flutter applications. It provides a customizable button with support for various visual styles, such as Material Design and Cupertino.

Example

import 'package:c2c_core/c2c_core.dart';
import 'package:flutter/material.dart';

class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});

Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('C2CSecondaryButton')),
body: C2CSecondaryButton(
onPressed: () {
print('Button pressed!');
},
child: 'Submit',
),
),
);
}
}

void main() => runApp(const ExampleApp());

Properties

child

The content of the button.

Type
dynamic (Widget/String)?

onPressed

A callback function to be invoked when the button is tapped.

Type
void Function()?

borderRadius

The border radius of the button.

Type
BorderRadius?

backgroundColor

The background color of the button.

Type
Color?

foregroundColor

The foreground (text) color of the button.

Type
Color?

disabled

Whether the button is disabled. When disabled, it doesn't respond to user interactions.

Type
bool

disabledBackgroundColor

The background color of the button when it's disabled.

Type
Color?

disabledForegroundColor

The foreground (text) color of the button when it's disabled.

Type
Color?

contentPadding

The padding around the content of the button.

Type
EdgeInsets?

leftIcon

A widget to display as the left icon within the button.

Type
Widget?

leftIconPadding

Padding for the left icon.

Type
EdgeInsets?

rightIcon

A widget to display as the right icon within the button.

Type
Widget?

rightIconPadding

Padding for the right icon.

Type
EdgeInsets?

isExpanded

Whether the button should expand to fill available space.

Type
bool?

onLongPress

A callback function to be invoked when the button is long-pressed.

Type
void Function()?

size

The height of the button. (large (52) | medium (48) | small (40) | custom (null)). Default: ButtonSize.large

Type
ButtonSize?

textStyle

The text style of the button's content.

Type
TextStyle?

contentAlignment

The alignment of the content within the button.

Type
MainAxisAlignment

contentBuilder

A custom builder function for the button's content.

Type
Widget Function(BuildContext)?

type

The type of the button.

Type
StyleType

focusedBackgroundColor

The background color of the button when it's focused (iOS only).

Type
Color?

focusedForegroundColor

The color of the button's content when it's focused (iOS only).

Type
Color?

style

Custom button style. (Android Only)

Type
ButtonStyle?

borderSide

The border side of the button.

Type
BorderSide?

disabledBorderSide

The border side of the button when it's disabled.

Type
BorderSide?