RichText Widget Futter

RichText Widget Futter: রিচটেক্সট উইজেটটি বিভিন্ন স্টাইল ব্যবহার করে এমন পাঠ্য প্রদর্শন করতে ব্যবহৃত হয়। প্রদর্শিত পাঠ্যটি TextSpan অবজেক্টের একটি ট্রি ব্যবহার করে বর্ণনা করা হয়েছে, যার প্রত্যেকটির নিজস্ব সংশ্লিষ্ট শৈলী রয়েছে যা সেই সাবট্রির জন্য ব্যবহৃত হয়।(RichText Widget Futter)

Constructors:

Syntax:
RichText(
{Key key,
@required InlineSpan text,
TextAlign textAlign: TextAlign.start, 
TextDirection textDirection, 
bool softWrap: true, 
TextOverflow overflow: 
TextOverflow.clip, 
double textScaleFactor: 1.0, 
int maxLines, 
Locale locale, 
StrutStyle strutStyle, 
TextWidthBasis textWidthBasis: TextWidthBasis.parent, 
TextHeightBehavior textHeightBehavior,

Properties:

  • children: The widgets below this widget in the tree.
  • hashCode: The hash code for this object.
  • key: Controls how one widget replaces another widget in the tree.
  • runtimeType: A representation of the runtime type of the object.
  • text: The text to display in this widget.
  • textAlign: How the text should be aligned horizontally.
  • local: This property takes in Locale class as the object. It controls the font used for the text depending on the language used.
  • maxLines: The maxLines property takes in an int value as the object. It controls the maximum number of the line that can be there for the text to expand and wrap.
  • overflow: TextOverflow enum is the object given to its class it controls the text in case of overflow.
  • softWrap: This property takes in a boolean value as the object. If it is set to false the gulphs in the text become wider.
  • textDirection: This property takes in TextDirection class as the object to decide the direction of the text. It can be either from left-to-right or right-to-left.
  • textHightBehaviour: TextHeightBehavior class is the object given to this property. It controls how the text will be highlighted.
  • textScaleFactor: This property taken in a double value as the object to determine the relative size of the font.
  • textWidthBasis: TextWidthBasis enum is the object of this property. It controls the width of a single line of text is being measured.
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
// This widget is
//the root of your application.
@override
Widget build(BuildContext context) {
	return MaterialApp(
	title: 'ClipOval',
	theme: ThemeData(
		primarySwatch: Colors.blue,
	),
	home: MyHomePAGE(),
	debugShowCheckedModeBanner: false,
	);
}
}

class MyHomePAGE extends StatefulWidget {
@override
_MyHomePAGEState createState() => _MyHomePAGEState();
}

class _MyHomePAGEState extends State<MyHomePAGE> {
@override
Widget build(BuildContext context) {
	return Scaffold(
	appBar: AppBar(
		title: Text('BnCodeing'),
		backgroundColor: Colors.green,
	),
	body: Center(
		child: RichText(
			text: TextSpan(
			text: 'Hello ',
			style: DefaultTextStyle.of(context).style,
			children: <TextSpan>[
				TextSpan(text: 'Geeks', style: TextStyle(fontWeight: FontWeight.bold)),
			],
			),
		)
	),
	backgroundColor: Colors.lightBlue[50],
	);
}
}

class MyClip extends CustomClipper<Rect> {
Rect getClip(Size size) {
	return Rect.fromLTWH(0, 0, 100, 100);
}

bool shouldReclip(oldClipper) {
	return false;
}
}

Leave a Reply