Saturday, January 14, 2023

Create TextClass

 

Create TextClass


import 'package:flutter/material.dart';

class TextWidget extends StatelessWidget{

// Class Variable
  final String text;
  final double textSize;
  final FontWeight fontWeight;
  final Color color;
  final int maxLine;
  final TextAlign align;
    
// Constructor
  const TextWidget({Key? key,
  required this.text,
  required this.textSize,
  required this.fontWeight,
  required this.color,
  required this.maxLine,
  required this.align,

  }) : super(key: key);
 
  @override
  Widget build(BuildContext context) {

    return Text(
      text,
      overflow: TextOverflow.ellipsis,
      maxLines: maxLine,
      textAlign: align,
      style: Theme.of(context).textTheme.headline1!.copyWith(
        fontSize: textSize,
        fontWeight: fontWeight,
        color: color,
      ),

    );
  }

}

No comments:

Post a Comment

Featured post

Compress Image With Show File Size & Resolution in Flutter

 Compress Image With Show File Size & Resolution  1.Multiple File Image Compress with file Size import 'dart:io' ; import 'p...

LightBlog