Create Text with Flutter – Compose – SwiftUI

mobile academy

Flutter :

import 'package:flutter/material.dart';

class CustomText extends StatelessWidget {
  final String label;
  const CustomText({required this.label, Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Text(
      label, 
      style: const TextStyle(
        color: Colors.blue, 
        fontSize: 18,
      ),
  );
      
  }
}

SwiftUI:

import SwiftUI

struct TextUIView: View {
    var body: some View {
        Text("Home Page")
            .font(.system(size:18))
            .foregroundColor(Color.blue)
        
        
    }
}

struct TextUIView_Previews: PreviewProvider {
    static var previews: some View {
        TextUIView()
    }
}

Compose:

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Edit
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.composeuidemo.ui.theme.ComposeUIDemoTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            HomeScreen()            
        }
    }
}

@Composable
fun HomeScreen() {
    CustomText("Next page")
   
}

@Composable
fun CustomText(label: String) {
    Text(
        text = label,
        color = Color.Blue,
        fontSize = 18.sp
    )
}
Select your currency
USD United States (US) dollar