Flutter ClipOval Widget – Circle Image



The ClipOval widget has a simple constructor that takes a child widget, an optional clipper, and an optional clip behavior as parameters. The child widget can be any widget that you want to display inside the oval shape, such as an image, text, or container.

The clipper parameter allows you to customize the size and position of the oval shape by implementing a custom class that extends CustomClipper. The clip behavior parameter controls how Flutter clips the object, and it can be one of these values: Clip.hardEdge, Clip.antiAlias, or Clip.antiAliasWithSaveLayer.

ClipOval Widget example:

ClipOval(
          child: Image.network(
            "https://cdn.pixabay.com/photo/2022/08/17/08/58/sun-has-7391959_960_720.jpg",
            fit: BoxFit.cover, // if you not use fit then not show image clearly...
          ),
        ),

Flutter ClipOval Widget Example

ClipOval

Tutorial source code example:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';

main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(body: HomePage()),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    // Welcome to my channel.....
    // How any image .... circle using ClipOval widget....let's started....
    return Container(
      alignment: Alignment.center,
      padding: EdgeInsets.all(15),
      child: SizedBox(
        width: 250,
        height: 250,
        child: ClipOval(
          child: Image.network(
            "https://cdn.pixabay.com/photo/2022/08/17/08/58/sun-has-7391959_960_720.jpg",
            fit: BoxFit.cover, // if you not use fit then not show image clearly...
          ),
        ),
      ),

      // here already show image.. now circle it....
      // you can ...change this size usign .... SIzebox widget...
      // Thank you.... Please SUBSCIBE me.... code link in the description below...
    );
  }
}
  • Boost WooCommerce Security: Set Up OTP Login in WordPress
    Passwords, while essential for security, can be vulnerable to hacking and breaches. To add an extra layer of protection for your WooCommerce store, consider implementing an OTP (One-Time Password) login. This guide walks you through the process of setting up an OTP login in WordPress for enhanced security. Why Use OTP Login? Enhanced Security: OTPs …

    Read more …

  • How to Create Woocommerce Flutter App for WordPress free
    Absolutely! Let’s break down how to create a WooCommerce Flutter app for your WordPress store. Here’s a comprehensive outline of the process and essential considerations: 1. Setup Your Development Environment 2. Project Structure 3. Dependencies 4. Core Functionality 5. User Interface (UI) and User Experience 6. Additional Features (Optional) Example Code Snippet (Fetching Products) Important …

    Read more …

  • How to Add a Link to Your Facebook Story in 2024
    Facebook Stories have become an integral part of our social media experience, allowing us to share moments and updates with our friends and followers. But did you know that you can also add links to your Facebook Stories? Adding a link to your story can be a powerful way to drive traffic to your website, …

    Read more …

  • Troubleshooting “Failed to download Laravel from dist” Error
    If you encounter the “Failed to download Laravel from dist” error while working with Laravel 10, it is likely due to the absence of the zip extension and unzip/7z commands on your system. This error prevents the successful download of Laravel from the distribution (dist) repository. What causes this error? The error occurs when the …

    Read more …

  • Solutions for “The file is too large for the destination file system” Error on Pendrive
    If you have ever encountered the frustrating error message “The file is too large for the destination file system” when trying to transfer files to your pendrive, don’t worry! There are a few solutions you can try to resolve this issue. 1. Format the Pendrive: One of the easiest ways to fix this error is …

    Read more …

Read also, Flutter Card Widget Ui Design.

The ClipOval widget is useful for creating interesting effects with images or other widgets.

Leave a Comment