Flutter Positioned Widget In Sinhala

Flutter Positioned Widget In Sinhala

Positioned යනු flutter SDK සමඟින් එන විජට් එකකි. Positioned එක එක මත අත්තනෝමතික ලෙස ස්ථානගත කරන ලද widgets වන, එය හරියටම ශබ්ද කරයි. එය සාමාන්‍යයෙන් ස්ටැක් විජට් හෝ ඊට සමාන ළමා විජට් ස්ථානගත කිරීමට භාවිතා කරයි.

 

Constructor of Positioned Class:

It is responsible for controlling where a child of Stack is positioned.

const Positioned(

{Key key,

double left,

double top,

double right,

double bottom,

double width,

double height,

@required Widget child}

)

Constructor of Positioned.directional class:

It is responsible for controlling where a child of Stack is positioned. But has additional properties for specifying the Text direction.

Positioned.directional(

{Key key,

@required TextDirection textDirection,

double start,

double top,

double end,

double bottom,

double width,

double height,

@required Widget child}

)

 

Constructor of Positioned.fill class:

It creates a Positioned object with a default value set to 0.0 for left, top, right, and bottom unless a value for them is passed.

const Positioned.fill(

{Key key,

double left: 0.0,

double top: 0.0,

double right: 0.0,

double bottom: 0.0,

@required Widget child}

)

Constructor of Positioned.fromRect class:

It is used to create a Positioned object with the values from the given Rect.

Positioned.fromRect(

{Key key,

Rect rect,

@required Widget child}

)

Constructor of Positioned.fromRelativeRect class:

It is used to create a Positioned object with the values from the given RelativeRect.

Positioned.fromRelativeRect(

{Key key,

RelativeRect rect,

@required Widget child}

)

Properties of Positioned Widget: 

  • bottom: This property controls the distance that the child widgets are inset from the bottom of the Stack. It takes in a double value as the object.

  • debugTypicalAncestorWidgetClass: This widget takes in a Type class as the object. In the case of an error, this gives information about what widget typically wraps this ParentdataWidget.

  • height: This property takes in a double value as the object to decide the height of its child widget.

  • left: This property controls the distance that the child widgets are inset from the left of the Stack. It takes in a double value as the object.

  • top: The top property also takes in a double value to decide the distance between the top edge of the child widget and the Stack.

  • width: This property takes in a double value to decide the width of the child widget.

 

import 'package:flutter/material.dart';

 

// Material design library

void main() {

runApp(


// widget tree starts here

MaterialApp(

home: Scaffold(

appBar: AppBar(

title: Text('Apps Lanka Dev'),

backgroundColor: Colors.greenAccent[400],

centerTitle: true,

), //AppBar

body: Padding(

padding: EdgeInsets.only(top: 300),

child: Stack(

alignment: AlignmentDirectional.center,

children: [


/** Positioned WIdget **/

Positioned(

top: 0.0,

child: Icon(Icons.message,

size: 128.0, color: Colors.greenAccent[400]), //Icon

), //Positioned

/** Positioned WIdget **/


Positioned(

top: 0,

right: 285,

child: CircleAvatar(

radius: 16,

backgroundColor: Colors.red,

foregroundColor: Colors.white,

child: Text('24'),

), //CircularAvatar

), //Positioned

], //[]

), //Stack

), //Padding

), //Scaffold

), //MaterialApp

);

}

 


 We are developing Mobile application and Web application for more details visit our web site www.appslanka.lk

0 Comments

Leave a comment

Your email address will not be published. Required fields are marked *