Skip to content

SyncfusionExamples/How-to-disable-the-outer-border-in-the-flutter-DataGrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to disable the outer border in the Flutter DataGrid (SfDataGrid)?.

In this article, we will show you how to disable the outer border in the Flutter DataGrid.

Initialize the SfDataGrid widget with all the required properties. Use the ClipRect widget along with a custom clipper (CustomClipper) to remove the outer borders. To achieve this, create a custom clipper class by extending the CustomClipper class. In the getClip method, use Rect.fromLTWH to set the grid line stroke width for the left and top sides, and specify the appropriate size for the right and bottom sides based on the grid layout. After defining this custom clipper, wrap the SfDataGrid with the ClipRect widget to control the visibility of the borders as desired.

 @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Flutter SfDataGrid'),
        ),
        body: ClipRect(
          clipper: CustomLeftClipper(),
          child: SfDataGrid(
            columnWidthMode: ColumnWidthMode.fill,
            source: _employeeDataSource,
            gridLinesVisibility: GridLinesVisibility.vertical,
            headerGridLinesVisibility: GridLinesVisibility.vertical,
            columns: getColumns,
          ),
        ));
  }

class CustomLeftClipper extends CustomClipper<Rect> {
  @override
  Rect getClip(Size size) {
    return Rect.fromLTWH(2, 2, size.width - 4, size.height - 58);
  }

  @override
  bool shouldReclip(CustomClipper<Rect> oldClipper) => false;
}

You can download this example on GitHub.

About

How to disable the outer border in the flutter DataGrid

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •