0% found this document useful (0 votes)
4 views

immediate

Uploaded by

THE UNIQUE WEY
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

immediate

Uploaded by

THE UNIQUE WEY
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

//how to use sliver app bar

SliverAppBar(
pinned: true,
// floating: true,
expandedHeight: 200,
flexibleSpace: FlexibleSpaceBar(
title: Text('Login Screen'),
background: Image.network(
'https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-
729510_1280.jpg',
fit: BoxFit.fill,
),
),
));
SliverList(
delegate: SliverChildListDelegate([]),
);

//roundButton customize

import 'package:flutter/material.dart';

// ignore: camel_case_types
class roundButton extends StatelessWidget {
final String title;
final VoidCallback onTap;
final bool loading;
const roundButton(
{Key? key,
required this.title,
required this.onTap,
this.loading = false})
: super(key: key);

@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
height: 50,
decoration: BoxDecoration(
color: const Color(0xff009688), borderRadius:
BorderRadius.circular(10)),
child: Center(
child: loading
? const CircularProgressIndicator(
strokeWidth: 3,
color: Colors.white ,
)
: Text(title)),
),
);
}
}
//Splash screen

// ignore: file_names
import 'package:firebasetodo/firebase_services/splash_Services.dart';
import 'package:flutter/material.dart';

class splashScreen extends StatefulWidget {


const splashScreen({super.key});

@override
State<splashScreen> createState() => _splashScreenState();
}

// ignore: camel_case_types
class _splashScreenState extends State<splashScreen> {
splashServices splashScreen = splashServices();
@override
void initState() {
// TODO: implement initState
super.initState();
splashScreen.isLogin(context);
}

@override
Widget build(BuildContext context) {
return const Scaffold(
backgroundColor: Color(0xffffaebd),
body: Center(
child: Text(
'Splash Screen',
style: TextStyle(fontSize: 30),
),
),
);
}
}

//splash_Services

// ignore: file_names
import 'dart:async';

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebasetodo/ui/login_screen.dart';
import 'package:firebasetodo/ui/upload_image.dart';
import 'package:flutter/material.dart';

// ignore: camel_case_types
class splashServices {
void isLogin(BuildContext context) {
final auth = FirebaseAuth.instance;
final User = auth.currentUser;
if (User != null) {
Timer(
const Duration(seconds: 3),
() => Navigator.push(
context,
MaterialPageRoute(
// builder: (context) => const login_screen(),//real time database
// builder: (context) => const
FireStoreScreen(),//firebase_firestore
builder: (context) => const login_screen(),
)));
} else {
Timer(
const Duration(seconds: 3),
() => Navigator.push(context,
MaterialPageRoute(builder: (context) => const login_screen())));
}
}
}

//Utils.toast message

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class Utils {
void toastmessage(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0);
}
}

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Responsive Button'),
),
body: Center(
child: MyButton(),
),
),
);
}
}

class MyButton extends StatefulWidget {


@override
_MyButtonState createState() => _MyButtonState();
}

class _MyButtonState extends State<MyButton> {


bool _isPressed = false;

void _onTapDown(TapDownDetails details) {


setState(() {
_isPressed = true;
});
}

void _onTapUp(TapUpDetails details) {


setState(() {
_isPressed = false;
});
}

@override
Widget build(BuildContext context) {
return GestureDetector(
onTapDown: _onTapDown,
onTapUp: _onTapUp,
child: AnimatedContainer(
duration: Duration(milliseconds: 50),
curve: Curves.easeInOut,
width: _isPressed ? 60 : 70,
height: _isPressed ? 60 : 70,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10),
),
child: Center(
child: Text(
'Tap Me',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
),
),
);
}
}

You might also like