can we create a new widget in Flutter?

flutter home screen widget
flutter stateful widget
flutter widgets
flutter widgets examples
flutter widget lifecycle
flutter card widget example
flutter get state from widget
flutter extend widget

being new to Flutter i've noticed that it offers a lot of widgets to choose from. But my question is : Can we make our own? foe example, Can I make my own kind of button that's not already offered?

Yes you can create your own widget. For example, as you stated above, you can create a custom button using code like the one below.

The properties that you see inside the OutlineButton constructor build the button with a red background color, a circular border-radius of 32px and a text. The is also a onPressed function inside there that is executed when you press the button; in the example below after pressing the button you print to the console the statement I pressed it.

Widget _buildButton(BuildContext context){
    return OutlineButton(
      onPressed: (){
        print('I pressed it');
      },
      color: Colors.red,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)),
      child: Text('CUSTOM BUTTON'),
    );
  }

You can also wrap your button inside a ButtonTheme widget, which offers you multiple features, one of them is to scale the button with the sizes you need.

Widget _buildButton(BuildContext context){
    return ButtonTheme(
      height: 100,
      minWidth: 100,

      child: OutlineButton(
        onPressed: (){},
        color: Colors.red,
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)),
        child: Text('CUSTOM BUTTON'),
      ),
    );
  }

Flutter: The power of small and reusable widgets, > children; TileData({this. children}); Then, in your build method, pass the property to the column. In flutter we would use Widget keyword along with widget name to create custom widgets. Flutter gives us functionality to make designing easier using custom widgets. Using custom widgets we can easily existing widgets and also make new widgets by modifying current widgets. Custom widgets has return area which would return us complete widget pass in it. Widget is the center of development in flutter framework.

Yes you can create custom widgets in flutter. The following code creates custom button as:

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

class CustomButton extends StatelessWidget {
  CustomButton({@required this.onPressed});
  final GestureTapCallback onPressed;

  @override
  Widget build(BuildContext context) {
    return RawMaterialButton(
      fillColor: Colors.green,
      splashColor: Colors.greenAccent,
      child: Padding(
        padding: EdgeInsets.all(10.0),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: const <Widget>[
            Icon(
              Icons.face,
              color: Colors.amber,
            ),
            SizedBox(
              width: 10.0,
            ),
            Text(
              "Tap Me",
              maxLines: 1,
              style: TextStyle(color: Colors.white),
            ),
          ],
        ),
      ),
      onPressed: onPressed,
      shape: const StadiumBorder(),
    );
  }
}

You can use the CustomButton like this:

class _CustomWidgetDemoState extends State<CustomWidgetDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Text("here is a custom button in FLutter"),
            CustomButton(
              onPressed: () {
                print("Tapped Me");
              },
            )
          ],
        ),
      ),
    );
  }
}

Need help in making a reusable widget in flutter, Compared to creating a big widget tree inside one long build method, defining custom widgets will make our code clearer and more reusable. You don’t need to know a lot about Flutter to create widgets. But what you do need is a Flutter app development environment. You can choose and set up one from either Android Studio, IntelliJ, or Visual Studio Code. And yes, you also need to know the process of creating a Flutter app.

Yes, you can create your own widget even with animation using Flare

See this tutorial:

https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part3-implement-animation-in-flutter-project-f335f88311c8

Flutter : From Zero To Comfortable, When getting started with Flutter, one of the first things you need to learn You can also Duration: 6:58 Posted: Feb 14, 2019 In this case, we have an onTap method (which can be found in a button). In this method, we use Flutter’s Navigator widget and want to push our screen so we can visit it. The navigation can be done in the way you want. Next we put our ReusableScreen widget inside the push method. Now we can pass our custom arguments, see image below.

Introduction to widgets, The action of the proceed button. To this new screen, we can navigate and pass all our custom data. In Flutter, a widget can be created by composing one or more widgets. To compose multiple widgets into a single widget, Flutter provides large number of widgets with layout feature. For example, the child widget can be centered using Center widget. Some of the popular layout widgets are as follows −.

How to Create Stateless Widgets - Flutter, Watch Martin Aguinis from the Flutter team build and customize a widget for a shopping app Duration: 10:05 Posted: May 22, 2018 Then, Flutter progresses through all of the build () methods in the widget tree, creating widgets and using them to make elements, until everything is built, mounted onscreen, and ready to be laid

Building Your First Reusable Widget with Flutter, Flutter: Creating Custom Reusable Widgets If you'd like to support the free content, you Duration: 7:40 Posted: Jun 10, 2019 Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more Creating a custom clock widget in Flutter