A button that looks like a Cupertino text button

Overview

Cupertino Text Button pub version

CodeFactor

A button that looks like a Cupertino text button!

example

Text Button

A simple text button can be created like this:

CupertinoTextButton(
    text: 'Apply',
    style: const TextStyle(fontSize: 20),
    onTap: () {
        // Do your text stuff here.
    },
),

For text buttons you can configure the following properties:

Property Type Description
text String Title of the button
style TextStyle Text style of the title
textAlign TextAlign Text alignment of the button
textDirection TextDirection The text direction to use for rendering the text
textOverflow TextOverflow The text direction to use for rendering the text
softWrap bool Whether the text should break at soft line breaks

Material Icon Button

A simple material icon button can be created like this:

CupertinoTextButton.materialIcon(
    icon: Icons.chevron_left,
    size: 30,
    onTap: () {
        // Do your icon stuff here.
    },
),

For material icon buttons you can configure the following properties:

Property Type Description
icon IconData Icon to display
size double Size of the icon
textDirection TextDirection The text direction to use for rendering the icon

Common Properties

Either you creating a text or an icon button, you can specify these properties:

Property Type Description
onTap Function On tap handler of the button
onLongPress Function On long press handler of the button
normalColor Color Foreground color of the button in normal state, e.g. not pressed
pressedColor Color Foreground color of the button in pressed state
forwardDuration Duration Duration of the animation from normalColor to pressedColor
backwardDuration Duration Duration of the animation back from pressedColor to normalColor
curve Curve The animation curve.

Theme

All these shared properties, except for the onTap and onLongPress ones, can be configured via the CupertinoTextButtonTheme. Just wrap it around your app or any other parent widget above CupertinoTextButtons in the tree like this:

CupertinoTextButtonTheme(
    normalColor: Colors.white,
    pressedColor: Colors.orange,
    /* forwardDuration, backwardDuration and curve can also be configured here. */
    child: Row(
        children: [
            CupertinoTextButton(
                text: 'First Option',
                style: const TextStyle(fontSize: 20),
                onTap: () {
                    // Do your first stuff here.
                },
            ),
            CupertinoTextButton(
                text: 'Second Option',
                style: const TextStyle(fontSize: 20),
                onTap: () {
                    // Do your second stuff here.
                },
            ),
        ],
    ),
)

And both of these text button will have the same colors!

If these properties are not specified in the button and no theme is provided, fallback values are used:

Property Fallback Value
normalColor Colors.black
pressedColor Theme*.primaryColor
forwardDuration const Duration(milliseconds: 20)
backwardDuration const Duration(milliseconds: 200)
curve Curves.fastOutSlowIn

* Theme β€” the default Flutter Theme.

You might also like...

A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.

Jan 6, 2023

A Flutter widget that scrolls text infinitely

⏩ A Flutter widget that scrolls text infinitely. Provides many customizations including custom scroll directions, durations, curves as well as pauses after every round.

Dec 29, 2022

Listview builder with image and text

listview_builder_with_image_and_text A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resource

May 4, 2022

This repo is for anything that can be reusable in flutter like custom widgets πŸŸ₯, animations 🌟and more

Flutter Shortcuts This repo is for anything that can be reusable in flutter like custom widgets πŸŸ₯ , animations 🌟 and more. How to Use Just get the f

Dec 3, 2022

A basic Flutter app that includes some native Widgets like alerts, cards, avatars, animated container, inputs, etc.

A basic Flutter app that includes some native Widgets like alerts, cards, avatars, animated container, inputs, etc.

Flutter components This project was created with Flutter and some native Widgets like alerts, cards, avatars, animated container, inputs, etc. Getting

Nov 15, 2021

iOS-like proof of concept reorderable list with animations

iOS-like proof of concept reorderable list with animations

Reorderable List in Flutter iOS-like proof of concept reorderable list with animations Preview Getting Started See example/lib/main.dart for example u

Jan 2, 2023

A Facebook & Twitter Like Card Loading Shimmer Skeleton Library.

A Facebook & Twitter Like Card Loading Shimmer Skeleton Library.

PKSkeleton A Facebook & Twitter Like Card Loading Shimmer Skeleton Library. The source code is 100% Dart, and everything resides in the /lib folder. S

Nov 26, 2022

Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more.

Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more.

flutter_donation_buttons Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more. Getting S

Dec 10, 2022

A Flutter widget for chat like a speech bubble in Whatsapp and others

A Flutter widget for chat like a speech bubble in Whatsapp and others

A Flutter widget for chat like a speech bubble in Whatsapp and others

Oct 25, 2022
Releases(0.0.5)
Owner
Nick Sirovsky
Xamarin & Flutter Developer
Nick Sirovsky
Customizable Material and Cupertino buttons with progress indicators and more

future_button Customizable Material and Cupertino buttons with progress indicators and more.

Erzhan 33 Oct 13, 2022
Cupertino buttons which are used as radio buttons in order to select one value

Flutter Cupertino Radio Choice Cupertino buttons which are used as radio buttons in order to select one value. Tutorial A complete tutorial how to use

Christoph Rothermel 4 Sep 18, 2022
Experimental solution for web-like text selection across widgets

Better Selection Experimental solution for web-like text selection across widgets (text, images, et cetera). Better selection is dependent on, and is

Wilson Wilson 59 Oct 12, 2022
Flutter Custom, Text, 3D, Social media button's package

Flutter Button flutter_button, which is a flutter package, contains animated, cool and awesome buttons. That you may like, thanks to this package you

Ismael Shakverdiev 15 Dec 29, 2022
Flutter Triple Status Button can use toggle button but in three statuses.

triple_status_button Triple Status Button. Flutter Triple Status Button can use toggle button but in three statuses. Property Description height heigh

MahdiBagjani 2 Nov 13, 2021
Flutter reaction button plugin it is fully customizable widget such as Facebook reaction button

Flutter Reaction Button Flutter button reaction it is fully customizable widget such as Facebook reaction button. Preview Demo Usage Include 'flutter_

Abdelouahed Medjoudja 174 Dec 19, 2022
A Flutter Text widget support word break for CJK

word_break_text Text widget with word break support for CJK sentence. Installation Add flutter_map to your pubspec: dependencies: word_break_text:

ChangJoo Park(λ°•μ°½μ£Ό) 5 Nov 11, 2022
Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically.

Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically. Also comes with useful extensions to create text styles by composition.

Marcelo Glasberg 21 Jan 2, 2023
An advanced switch widget, that can be fully customized with size, text, color, radius of corners.

flutter_advanced_switch An advanced switch widget, that can be fully customized with size, text, color, radius of corners. Switch Light Switch Dark Ge

Alex Melnyk 13 Dec 15, 2022
Flutter widget to show text in popup or overlay container

flutter_show_more_text_popup Flutter widget to show text in popup or overlay container Installation Add this to your package's pubspec.yaml file depen

Sanjay Sharma 44 Jul 5, 2022