Skip to content

Instantly share code, notes, and snippets.

View vijayinyoutube's full-sized avatar
👋
vijaycreations

Vijay R vijayinyoutube

👋
vijaycreations
View GitHub Profile
import { Menu, Drawer, Button, Flex, Typography, ConfigProvider } from "antd";
import Sider from "antd/es/layout/Sider";
import { Dispatch, SetStateAction } from "react";
import { useLocation, useNavigate } from "react-router-dom";
const { Text } = Typography;
interface Props {
collapsed?: boolean;
setCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'dart:convert';
import 'package:flutter/foundation.dart';
class ResponseModel {
final String id;
final String object;
final String model;
final List choices;
Future<void> repeatNotofication() async {
var androidChannelSpecifications = AndroidNotificationDetails(
"CHANNEL_ID 2",
"CHANNEL_NAME 2",
"CHANNEL_DESCRIPTION 2",
importance: Importance.max,
priority: Priority.high,
);
var iosChannelSpecifications = IOSNotificationDetails();
class SliverListBldr extends StatelessWidget {
const SliverListBldr({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
class SliverSearch extends StatelessWidget {
const SliverSearch({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SliverAppBar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
elevation: 0,
class SliverAppBarBldr extends StatelessWidget {
const SliverAppBarBldr({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SliverAppBar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
elevation: 0,
return const Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBarBldr(), // <- corresponds to the top most image
SliverSearch(), // <- corresponds to search bar widget
SliverListBldr(), // <- corresponds to the body lists containers
],
),
);
Future<void> addStudents() async {
//creates a new doc with unique doc ID
return collectionRef
.add({
'Name': "TestName",
})
.then((value) => debugPrint("User Added"))
.catchError((error) => debugPrint("Failed to add user: $error"));
}
class FireStoreDataBase {
final CollectionReference collectionRef =
FirebaseFirestore.instance.collection("Students");
Future getData() async {
try {
//to get data from a single/particular document alone.
var temp = await collectionRef.doc("<your document ID here>").get();
return temp;
} catch (e) {
setBadgeNum(int count, BuildContext context) async {
try {
await FlutterDynamicIcon.setApplicationIconBadgeNumber(count);
} on PlatformException {
print('Exception: Platform not supported');
} catch (e) {
print(e);
}
// To get currently badge number that was set.
int badgeNumber = await FlutterDynamicIcon.getApplicationIconBadgeNumber();