Skip to main content

Highlight

The C2CButtonHighlight widget is a customizable button that provides feedback to user interactions like tapping and holding. It is a versatile button that can be configured with various properties to suit your application's needs.

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('C2CButtonHighlight')),
body: C2CButtonHighlight(
onPressed: () {
print('Button pressed!');
},
child: 'Submit',
),
),
);
}
}

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

Properties

child

The content of the button. It can be either a String or a Widget.

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 be displayed to the left of the button's content.

Type
Widget?

leftIconPadding

Padding for the left icon.

Type
EdgeInsets?

rightIcon

A widget to be displayed to the right of the button's content.

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)?

borderSide

The border side of the button.

Type
BorderSide?

disabledBorderSide

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

Type
BorderSide?

focusedBackgroundColor

The background color of the button when it's focused (e.g., tapped or held).

Type
Color?

focusedForegroundColor

The foreground (text) color of the button when it's focused (e.g., tapped or held).

Type
Color?