repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
mirrored_repositories/flim_fusion
|
mirrored_repositories/flim_fusion/test/widget_test.dart
|
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:film_fusion/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0
|
mirrored_repositories/devquiz
|
mirrored_repositories/devquiz/lib/main.dart
|
import 'package:devquiz/core/app_widget.dart';
import 'package:flutter/material.dart';
void main() {
runApp(AppWidget());
}
| 0
|
mirrored_repositories/devquiz/lib/shared/widgets
|
mirrored_repositories/devquiz/lib/shared/widgets/progress_indicator/progress_indicator_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:flutter/material.dart';
class ProgressIndicatorWidget extends StatelessWidget {
final double value;
const ProgressIndicatorWidget({Key? key, required this.value}): super(key: key);
@override
Widget build(BuildContext context) {
return LinearProgressIndicator(
value: value,
backgroundColor: AppColors.chartSecondary,
valueColor: AlwaysStoppedAnimation<Color>(AppColors.chartPrimary),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/shared
|
mirrored_repositories/devquiz/lib/shared/model/question_model.dart
|
import 'dart:convert';
import 'package:devquiz/shared/model/awnser_model.dart';
class QuestionModel {
final String title;
final List<AwnserModel> awnsers;
QuestionModel({
required this.title,
required this.awnsers,
}) : assert(
awnsers.length == 4,
);
factory QuestionModel.fromMap(Map<String, dynamic> map) {
return new QuestionModel(
title: map['title'] as String,
awnsers: List<AwnserModel>.from(
map['awnsers']?.map((x) => AwnserModel.fromMap(x))),
);
}
Map<String, dynamic> toMap() {
// ignore: unnecessary_cast
return {
'title': this.title,
'awnsers': this.awnsers,
} as Map<String, dynamic>;
}
factory QuestionModel.fromJson(String source) =>
QuestionModel.fromMap(json.decode(source));
//
}
| 0
|
mirrored_repositories/devquiz/lib/shared
|
mirrored_repositories/devquiz/lib/shared/model/awnser_model.dart
|
import 'dart:convert';
class AwnserModel {
final String title;
final bool isRight;
AwnserModel({
required this.title,
this.isRight = false,
});
factory AwnserModel.fromMap(Map<String, dynamic> map) {
return new AwnserModel(
title: map['title'],
isRight: map['isRight'] ?? false,
);
}
Map<String, dynamic> toMap() {
// ignore: unnecessary_cast
return {
'title': this.title,
'isRight': this.isRight,
} as Map<String, dynamic>;
}
factory AwnserModel.fromJson(String source) =>
AwnserModel.fromMap(json.decode(source));
//
}
| 0
|
mirrored_repositories/devquiz/lib/shared
|
mirrored_repositories/devquiz/lib/shared/model/quiz_model.dart
|
import 'dart:convert';
import 'package:devquiz/shared/model/question_model.dart';
enum Level {
facil,
medio,
dificil,
perito,
}
extension LevelStringExt on String {
Level get parse => {
"facil": Level.facil,
"medio": Level.medio,
"dificil": Level.dificil,
"perito": Level.perito
}[this]!;
}
extension LevelExt on Level {
String get parse => {
Level.facil: "facil",
Level.dificil: "dificil",
Level.medio: "medio",
Level.perito: "perito",
}[this]!;
}
class QuizModel {
final String title;
final List<QuestionModel> questions;
final int questionAnswered;
final String image;
final Level level;
QuizModel({
required this.title,
required this.questions,
this.questionAnswered = 0,
required this.image,
required this.level,
});
factory QuizModel.fromMap(Map<String, dynamic> map) {
return new QuizModel(
title: map['title'] as String,
questions: List<QuestionModel>.from(
map['questions']?.map((x) => QuestionModel.fromMap(x))),
questionAnswered: map['questionAnswered'] as int,
image: map['image'] as String,
level: map['level'].toString().parse,
);
}
Map<String, dynamic> toMap() {
// ignore: unnecessary_cast
return {
'title': this.title,
'questions': this.questions,
'questionAnswered': this.questionAnswered,
'image': this.image,
'level': this.level.parse,
} as Map<String, dynamic>;
}
factory QuizModel.fromJson(String source) =>
QuizModel.fromMap(json.decode(source));
//
}
| 0
|
mirrored_repositories/devquiz/lib/shared
|
mirrored_repositories/devquiz/lib/shared/model/user_model.dart
|
import 'dart:convert';
class UserModel {
final String userName;
final String photoUrl;
final int score;
UserModel({
required this.userName,
required this.photoUrl,
this.score =0,
});
factory UserModel.fromMap(Map<String, dynamic> map) {
return new UserModel(
userName: map['userName'] as String,
photoUrl: map['photoUrl'] as String,
score: map['score'] as int,
);
}
Map<String, dynamic> toMap() {
// ignore: unnecessary_cast
return {
'userName': this.userName,
'photoUrl': this.photoUrl,
'score': this.score,
} as Map<String, dynamic>;
}
factory UserModel.fromJson(String source) => UserModel.fromMap(json.decode(source));
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/core/app_widget.dart
|
import 'package:devquiz/splash/splash_page.dart';
import 'package:flutter/material.dart';
class AppWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "DevQuiz",
home: SplashPage(),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/core/app_gradients.dart
|
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
class AppGradients {
static final linear = LinearGradient(colors: [
Color(0xFF57B6E5),
Color.fromRGBO(130, 87, 229, 0.695),
], stops: [
0.0,
0.695
], transform: GradientRotation(2.13959913 * pi));
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/core/core.dart
|
export './app_colors.dart';
export './app_gradients.dart';
export './app_widget.dart';
export './app_text_styles.dart';
export './app_images.dart';
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/core/app_text_styles.dart
|
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'app_colors.dart';
class AppTextStyles {
static final TextStyle title = GoogleFonts.notoSans(
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.w400,
);
static final TextStyle titleBold = GoogleFonts.notoSans(
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.w600,
);
static final TextStyle heading = GoogleFonts.notoSans(
color: AppColors.black,
fontSize: 18,
fontWeight: FontWeight.w600,
);
static final TextStyle heading40 = GoogleFonts.notoSans(
color: AppColors.black,
fontSize: 40,
fontWeight: FontWeight.w600,
);
static final TextStyle heading15 = GoogleFonts.notoSans(
color: AppColors.black,
fontSize: 15,
fontWeight: FontWeight.w600,
);
static final TextStyle body = GoogleFonts.notoSans(
color: AppColors.grey,
fontSize: 15,
fontWeight: FontWeight.normal,
);
static final TextStyle bodyBold = GoogleFonts.notoSans(
color: AppColors.grey,
fontSize: 13,
fontWeight: FontWeight.bold,
);
static final TextStyle bodylightGrey = GoogleFonts.notoSans(
color: AppColors.lightGreen,
fontSize: 13,
fontWeight: FontWeight.normal,
);
static final TextStyle bodyDarkGreen = GoogleFonts.notoSans(
color: AppColors.darkGreen,
fontSize: 13,
fontWeight: FontWeight.w500,
);
static final TextStyle bodyDarkRed = GoogleFonts.notoSans(
color: AppColors.darkRed,
fontSize: 13,
fontWeight: FontWeight.w500,
);
static final TextStyle body20 = GoogleFonts.notoSans(
color: AppColors.grey,
fontSize: 20,
fontWeight: FontWeight.normal,
);
static final TextStyle bodyLightGrey20 = GoogleFonts.notoSans(
color: AppColors.lightGrey,
fontSize: 20,
fontWeight: FontWeight.normal,
);
static final TextStyle bodyWhite20 = GoogleFonts.notoSans(
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.normal,
);
static final TextStyle body11 = GoogleFonts.notoSans(
color: AppColors.grey,
fontSize: 11,
fontWeight: FontWeight.normal,
);
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/core/app_colors.dart
|
import 'package:flutter/material.dart';
class AppColors {
static final Color purple = Color(0xFF8257E5);
static final Color white = Color(0xFFFFFFFF);
static final Color black = Color(0xFF514766);
static final Color grey = Color(0xFF6E6680);
static final Color lightGrey = Color(0xFFA6A1B2);
static final Color border = Color(0xFFE1E1E6);
static final Color chartSecondary = Color(0xFFE1E6E3);
static final Color chartPrimary = darkGreen;
//Greens
static final Color lightGreen = Color(0xFFE1F5EC);
static final Color green = Color(0xFFB8DBCB);
static final Color darkGreen = Color(0xFF04D361);
//Reds
static final Color lightRed = Color(0xFFF5E9EC);
static final Color red = Color(0xFFE5C5CF);
static final Color darkRed = Color(0xFFCC3750);
//LevelButton
static final Color levelButtonFacil = Color(0xFFEBEBFC);
static final Color levelButtonMedio = lightGreen;
static final Color levelButtonDificil = Color(0xFFF5EFE9);
static final Color levelButtonPerito = lightRed;
static final Color levelButtonBorderFacil = Color(0xFFCECEF5);
static final Color levelButtonBorderMedio = green;
static final Color levelButtonBorderDificil = Color(0xFFE5D5C5);
static final Color levelButtonBorderPerito = red;
static final Color levelButtonTextFacil = Color(0xFF6363DB);
static final Color levelButtonTextMedio = darkGreen;
static final Color levelButtonTextDificil = Color(0xFFE8891C);
static final Color levelButtonTextPerito = darkRed;
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/core/app_images.dart
|
class AppImages {
static String get hierarchy => "assets/images/hierarchy.png";
static String get data => "assets/images/data.png";
static String get laptop => "assets/images/laptop.png";
static String get blocks => "assets/images/blocks.png";
static String get check => "assets/images/check.png";
static String get error => "assets/images/error.png";
static String get trophy => "assets/images/trophy.png";
static String get logo => "assets/images/logo.png";
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/result/result_page.dart
|
import 'package:devquiz/challenge/widgets/next_button/next_button_widget.dart';
import 'package:devquiz/core/app_images.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:flutter/material.dart';
import 'package:share_plus/share_plus.dart';
class ResultPage extends StatelessWidget {
final String title;
final int length;
final int result;
ResultPage({required this.title, required this.length, required this.result});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: double.maxFinite,
padding: EdgeInsets.only(top: 100),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(AppImages.trophy),
Column(
children: [
Text(
"Parabéns !",
style: AppTextStyles.heading40,
),
SizedBox(height: 16),
Text.rich(
TextSpan(
text: "Você concluiu",
style: AppTextStyles.body,
children: [
TextSpan(
text: "\n$title",
style: AppTextStyles.bodyBold),
TextSpan(
text: "\ncom $result de $length acertos.",
style: AppTextStyles.body),
],
),
textAlign: TextAlign.center,
),
],
),
Column(
children: [
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 60),
child: NextButtonWidget.purple(
label: "Compartilhar", onTap: () {
Share.share("DevQuiz NLW 5 - Flutter: Resultado do Quiz: $title \nObtive: ${result/length}% de aproveitamento! ");
}),
)),
],
),
SizedBox(height: 24),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 68),
child: NextButtonWidget.white(
label: "Voltar ao inicio",
onTap: () {
Navigator.pop(context);
}),
)),
],
),
],
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/challenge/challenge_page.dart
|
import 'package:devquiz/challenge/challange_controller.dart';
import 'package:devquiz/challenge/widgets/next_button/next_button_widget.dart';
import 'package:devquiz/challenge/widgets/question_indicator/question_indicator_widget.dart';
import 'package:devquiz/challenge/widgets/quiz/quiz_widget.dart';
import 'package:devquiz/result/result_page.dart';
import 'package:devquiz/shared/model/question_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ChallangePage extends StatefulWidget {
final List<QuestionModel> questions;
final String title;
ChallangePage({required this.questions, required this.title});
@override
_ChallangePageState createState() => _ChallangePageState();
}
class _ChallangePageState extends State<ChallangePage> {
final challangeController = ChallangeController();
final pageController = PageController();
@override
void initState() {
pageController.addListener(() {
challangeController.currentPage = pageController.page!.toInt() + 1;
});
super.initState();
}
void nextPage() {
pageController.nextPage(
duration: Duration(milliseconds: 300),
curve: Curves.linear);
}
void onSelected(bool value) {
if (value == true) {
challangeController.anwsersRight ++;
}
nextPage();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(88),
child: SafeArea(
top: true,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(
icon: Icon(Icons.close),
onPressed: () {
Navigator.pop(context);
},
),
ValueListenableBuilder<int>(
valueListenable: challangeController.currentPageNotifier,
builder: (context, value, _) =>
QuestionIndicatorWidget(
currentPage: value,
lenght: widget.questions.length,
),
),
],
),
),
),
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: widget.questions.map((e) =>
QuizWidget(question: e, onSelected:onSelected,)).toList(),
),
bottomNavigationBar: SafeArea(
bottom: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: ValueListenableBuilder<int>(
valueListenable: challangeController.currentPageNotifier,
builder: (controller, value, _) =>
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
if (value < widget.questions.length)
Expanded(
child: NextButtonWidget.white(
label: "Pular",
onTap: nextPage)),
if (value == widget.questions.length) SizedBox(width: 7),
if (value == widget.questions.length)
Expanded(
child: NextButtonWidget.darkGreen(
label: "Confirmar",
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ResultPage(title: widget.title,
length: widget.questions.length,
result: challangeController.anwsersRight,),
),
);
},
),
),
],
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/challenge/challange_controller.dart
|
import 'package:devquiz/shared/model/question_model.dart';
import 'package:flutter/cupertino.dart';
class ChallangeController {
final currentPageNotifier = ValueNotifier<int>(1);
int get currentPage => currentPageNotifier.value;
set currentPage(int value) => currentPageNotifier.value = value;
int anwsersRight = 0;
}
| 0
|
mirrored_repositories/devquiz/lib/challenge/widgets
|
mirrored_repositories/devquiz/lib/challenge/widgets/next_button/next_button_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class NextButtonWidget extends StatelessWidget {
final String label;
final Color backgroundColor;
final Color fontColor;
final Color borderColor;
final VoidCallback onTap;
NextButtonWidget({
required this.label,
required this.backgroundColor,
required this.fontColor,
required this.borderColor,
required this.onTap,
});
NextButtonWidget.darkGreen(
{required String label, required VoidCallback onTap})
: this.backgroundColor = AppColors.darkGreen,
this.fontColor = AppColors.white,
this.label = label,
this.borderColor = AppColors.darkGreen,
this.onTap = onTap;
NextButtonWidget.white({required String label, required VoidCallback onTap})
: this.backgroundColor = AppColors.white,
this.fontColor = AppColors.grey,
this.label = label,
this.borderColor = AppColors.border,
this.onTap = onTap;
NextButtonWidget.purple({required String label, required VoidCallback onTap})
: this.backgroundColor = AppColors.purple,
this.fontColor = AppColors.white,
this.label = label,
this.borderColor = AppColors.purple,
this.onTap = onTap;
@override
Widget build(BuildContext context) {
return Container(
height: 48,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
backgroundColor,
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
side: MaterialStateProperty.all(BorderSide(color: borderColor)),
),
onPressed: onTap,
child: Text(
label,
style: GoogleFonts.notoSans(
fontWeight: FontWeight.w600,
fontSize: 15,
color: fontColor,
),
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/challenge/widgets
|
mirrored_repositories/devquiz/lib/challenge/widgets/awnser/awnser_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:devquiz/shared/model/awnser_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
class AwnserWidget extends StatelessWidget {
final AwnserModel awnser;
final bool isSelected;
final ValueChanged<bool> onTap;
final bool disabled;
const AwnserWidget({
Key? key,
required this.awnser,
this.isSelected = false,
required this.onTap,
required this.disabled,
}) : super(key: key);
Color get _selectedColorRight =>
awnser.isRight ? AppColors.darkGreen : AppColors.darkRed;
Color get _selectedBorderRight =>
awnser.isRight ? AppColors.lightGreen : AppColors.lightRed;
Color get _selectedColorCardRight =>
awnser.isRight ? AppColors.lightGreen : AppColors.lightRed;
Color get _selectedBorderCardRight =>
awnser.isRight ? AppColors.green : AppColors.red;
TextStyle get _selectedTextStyleRight =>
awnser.isRight ? AppTextStyles.bodyDarkGreen : AppTextStyles.bodyDarkRed;
IconData get _selectedIconRight => awnser.isRight ? Icons.check : Icons.close;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: IgnorePointer(
ignoring: disabled,
child: GestureDetector(
onTap: (){
onTap(awnser.isRight);
},
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: isSelected ? _selectedColorCardRight : AppColors.white,
borderRadius: BorderRadius.circular(10),
border: Border.fromBorderSide(BorderSide(
color: isSelected ? _selectedBorderCardRight : AppColors.border,
)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
awnser.title,
style:
isSelected ? _selectedTextStyleRight : AppTextStyles.body,
),
),
Container(
width: 24,
height: 24,
decoration: BoxDecoration(
color: isSelected ? _selectedColorRight : AppColors.white,
borderRadius: BorderRadius.circular(500),
border: Border.fromBorderSide(BorderSide(
color: isSelected ? _selectedBorderRight : AppColors.border,
)),
),
child: isSelected
? Icon(
_selectedIconRight,
color: AppColors.white,
size: 16,
)
: null,
),
],
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/challenge/widgets
|
mirrored_repositories/devquiz/lib/challenge/widgets/quiz/quiz_widget.dart
|
import 'package:devquiz/challenge/widgets/awnser/awnser_widget.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:devquiz/shared/model/awnser_model.dart';
import 'package:devquiz/shared/model/question_model.dart';
import 'package:flutter/material.dart';
class QuizWidget extends StatefulWidget {
final QuestionModel question;
final ValueChanged<bool> onSelected;
const QuizWidget({Key? key, required this.question, required this.onSelected}) : super(key: key);
@override
_QuizWidgetState createState() => _QuizWidgetState();
}
class _QuizWidgetState extends State<QuizWidget> {
int indexSelected = -1;
AwnserModel awnser(int index) => widget.question.awnsers[index];
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
SizedBox(
height: 64,
),
Text(
widget.question.title,
style: AppTextStyles.heading,
),
SizedBox(
height: 24,
),
for (var i = 0; i < widget.question.awnsers.length; i++)
AwnserWidget(
awnser: awnser(i),
disabled: indexSelected !=-1,
isSelected: indexSelected == i,
onTap: (value) {
indexSelected = i;
setState(() {});
Future.delayed(Duration(seconds: 1)).then((_) => widget.onSelected(value));
},
),
],
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/challenge/widgets
|
mirrored_repositories/devquiz/lib/challenge/widgets/quiz/quiz_controller.dart
|
class QuizController {
var indexSelected = 0;
}
| 0
|
mirrored_repositories/devquiz/lib/challenge/widgets
|
mirrored_repositories/devquiz/lib/challenge/widgets/question_indicator/question_indicator_widget.dart
|
import 'package:devquiz/core/app_text_styles.dart';
import 'package:devquiz/shared/widgets/progress_indicator/progress_indicator_widget.dart';
import 'package:flutter/material.dart';
class QuestionIndicatorWidget extends StatelessWidget {
final int currentPage;
final int lenght;
QuestionIndicatorWidget({required this.currentPage, required this.lenght});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Questão $currentPage ",
style: AppTextStyles.body,
),
Text(
"de $lenght",
style: AppTextStyles.body,
),
],
),
SizedBox(height: 16,),
ProgressIndicatorWidget(
value: (currentPage/lenght ),
),
],
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/home/home_page.dart
|
import 'package:devquiz/challenge/challenge_page.dart';
import 'package:devquiz/core/app_colors.dart';
import 'package:devquiz/home/home_state.dart';
import 'package:devquiz/home/widgets/appbar/app_bar_widget.dart';
import 'package:devquiz/home/widgets/level_button/level_button_widget.dart';
import 'package:devquiz/home/widgets/quiz_card/quiz_card_widget.dart';
import 'package:flutter/material.dart';
import 'home_controller.dart';
class HomePage extends StatefulWidget {
HomePage({Key? key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final controller = HomeController();
@override
void initState() {
// TODO: implement initState
super.initState();
controller.getUser();
controller.getQuizzes();
controller.stateNotifier.addListener(() {
setState(() {});
});
}
@override
Widget build(BuildContext context) {
if (controller.state == HomeState.success) {
return Scaffold(
appBar: AppBarWidget(
userModel: controller.user!,
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LevelButtonWidget(label: "Fácil"),
LevelButtonWidget(label: "Médio"),
LevelButtonWidget(label: "Difícil"),
LevelButtonWidget(label: "Perito")
],
),
SizedBox(
height: 16,
),
Expanded(
child: GridView.count(
crossAxisSpacing: 8,
crossAxisCount: 2,
mainAxisSpacing: 16,
children: controller.quizzes!
.map((e) => QuizCardWidget(
title: e.title,
completed:
"${e.questionAnswered}/${e.questions.length}",
percent: e.questionAnswered / e.questions.length,
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => ChallangePage(questions: e.questions, title: e.title)),);
},
))
.toList(),
),
),
],
),
),
);
} else {
return Scaffold(
body: Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(AppColors.darkGreen),
),
),
);
}
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/home/home_state.dart
|
enum HomeState {
success,
loading,
error,
empty,
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/home/home_controller.dart
|
import 'package:devquiz/home/home_repository.dart';
import 'package:devquiz/home/home_state.dart';
import 'package:devquiz/shared/model/quiz_model.dart';
import 'package:devquiz/shared/model/user_model.dart';
import 'package:flutter/foundation.dart';
class HomeController {
final stateNotifier = ValueNotifier<HomeState>(HomeState.empty);
set state(HomeState state) => stateNotifier.value = state;
HomeState get state=> stateNotifier.value;
UserModel? user;
List<QuizModel>? quizzes;
final repository = HomeRepository();
void getUser() async {
state = HomeState.loading;
user = await repository.getUser();
state = HomeState.success;
}
void getQuizzes() async {
state = HomeState.loading;
quizzes = await repository.getQuizzes();
state = HomeState.success;
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/home/home_repository.dart
|
import 'dart:convert';
import 'package:devquiz/shared/model/quiz_model.dart';
import 'package:devquiz/shared/model/user_model.dart';
import 'package:flutter/services.dart';
class HomeRepository {
Future<UserModel> getUser() async {
await Future.delayed(Duration(seconds: 2));
final response = await rootBundle.loadString("database/user.json");
final user = UserModel.fromJson(response);
return user;
}
Future<List<QuizModel>> getQuizzes() async {
await Future.delayed(Duration(seconds: 2));
final response = await rootBundle.loadString("database/quizzes.json");
final list = jsonDecode(response) as List;
final quizzes = list.map((e) => QuizModel.fromMap(e)).toList();
return quizzes;
}
}
| 0
|
mirrored_repositories/devquiz/lib/home/widgets
|
mirrored_repositories/devquiz/lib/home/widgets/appbar/app_bar_widget.dart
|
import 'package:devquiz/core/app_gradients.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:devquiz/home/widgets/score_card/score_card_widget.dart';
import 'package:devquiz/shared/model/user_model.dart';
import 'package:flutter/cupertino.dart';
class AppBarWidget extends PreferredSize {
final UserModel userModel;
AppBarWidget({required this.userModel})
: super(
preferredSize: Size.fromHeight(250),
child: Container(
height: 250,
child: Stack(
children: [
Container(
height: 161,
decoration: BoxDecoration(
gradient: AppGradients.linear,
),
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text.rich(TextSpan(
text: "Olá, ",
style: AppTextStyles.title,
children: [
TextSpan(
text: userModel.userName,
style: AppTextStyles.titleBold,
)
])),
Container(
width: 58,
height: 58,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: NetworkImage(
userModel.photoUrl))),
)
],
),
),
Align(
alignment: Alignment(0.0,1.0),
child: ScoreCardWidget(percent: (userModel.score / 100),)),
],
),
),
);
}
| 0
|
mirrored_repositories/devquiz/lib/home/widgets
|
mirrored_repositories/devquiz/lib/home/widgets/score_card/score_card_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:devquiz/home/widgets/chart/chart_widget.dart';
import 'package:flutter/material.dart';
class ScoreCardWidget extends StatelessWidget {
final double percent;
const ScoreCardWidget({Key? key, required this.percent}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 20, right: 20),
child: Container(
height: 136,
decoration: BoxDecoration(
color: AppColors.white, borderRadius: BorderRadius.circular(15)),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: ChartWidget(percent: percent,),
),
Expanded(
flex: 3,
child: Padding(
padding: const EdgeInsets.only(left: 24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Vamos começar",
style: AppTextStyles.heading,
),
Text(
"Complete os desafios e avance em conhecimento",
style: AppTextStyles.body,
),
],
),
),
)
],
),
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/home/widgets
|
mirrored_repositories/devquiz/lib/home/widgets/level_button/level_button_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class LevelButtonWidget extends StatelessWidget {
final String label;
LevelButtonWidget({
Key? key,
required this.label,
}) : assert(["Fácil", "Médio", "Difícil", "Perito"].contains(label)),
super(key: key);
final config = {
"Fácil": {
"color": AppColors.levelButtonFacil,
"borderColor": AppColors.levelButtonBorderFacil,
"fontColor": AppColors.levelButtonTextFacil,
},
"Médio": {
"color": AppColors.levelButtonMedio,
"borderColor": AppColors.levelButtonBorderMedio,
"fontColor": AppColors.levelButtonTextMedio,
},
"Difícil": {
"color": AppColors.levelButtonDificil,
"borderColor": AppColors.levelButtonBorderDificil,
"fontColor": AppColors.levelButtonTextDificil,
},
"Perito": {
"color": AppColors.levelButtonPerito,
"borderColor": AppColors.levelButtonBorderPerito,
"fontColor": AppColors.levelButtonTextPerito,
},
};
Color get color => config[label]!['color']!;
Color get borderColor => config[label]!['borderColor']!;
Color get fontColor => config[label]!['fontColor']!;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: color,
border: Border.fromBorderSide(BorderSide(color: AppColors.border)),
borderRadius: BorderRadius.circular(28),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 6),
child: Text(
label,
style: GoogleFonts.notoSans(
color: fontColor,
fontSize: 13,
),
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/home/widgets
|
mirrored_repositories/devquiz/lib/home/widgets/quiz_card/quiz_card_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:devquiz/core/app_images.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:devquiz/shared/widgets/progress_indicator/progress_indicator_widget.dart';
import 'package:flutter/material.dart';
class QuizCardWidget extends StatelessWidget {
final String title;
final String completed;
final double percent;
final VoidCallback onTap;
QuizCardWidget({required this.title, required this.completed, required this.percent, required this.onTap});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
border: Border.fromBorderSide(BorderSide(color: AppColors.border)),
color: AppColors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 40,
width: 40,
child: Image.asset(AppImages.blocks),
),
SizedBox(
height: 16,
),
Text(
title,
style: AppTextStyles.heading15,
),
SizedBox(
height: 16,
),
Row(
children: [
Expanded(
flex: 1,
child: Text(
completed,
style: AppTextStyles.body11,
),
),
Expanded(
flex: 4,
child:ProgressIndicatorWidget(value: percent,)
)
],
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib/home/widgets
|
mirrored_repositories/devquiz/lib/home/widgets/chart/chart_widget.dart
|
import 'package:devquiz/core/app_colors.dart';
import 'package:devquiz/core/app_text_styles.dart';
import 'package:flutter/material.dart';
class ChartWidget extends StatefulWidget {
final double percent;
const ChartWidget({Key? key, required this.percent}) : super(key: key);
@override
_ChartWidgetState createState() => _ChartWidgetState();
}
class _ChartWidgetState extends State<ChartWidget>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
void _initAnimation() {
_controller =
AnimationController(vsync: this, duration: Duration(seconds: 3));
_animation =
Tween<double>(begin: 0.0, end: widget.percent).animate(_controller);
_controller.forward();
}
@override
void initState() {
_initAnimation();
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
width: 80,
height: 80,
child: AnimatedBuilder(
animation: _animation,
builder: (context, _) => Stack(
children: [
Center(
child: Container(
width: 80,
height: 80,
child: CircularProgressIndicator(
strokeWidth: 10,
value: _animation.value,
backgroundColor: AppColors.chartSecondary,
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.chartPrimary),
),
),
),
Center(
child: Text(
"${(_animation.value * 100).toInt()}%",
style: AppTextStyles.heading,
))
],
),
),
);
}
}
| 0
|
mirrored_repositories/devquiz/lib
|
mirrored_repositories/devquiz/lib/splash/splash_page.dart
|
import 'package:devquiz/core/app_gradients.dart';
import 'package:devquiz/core/app_images.dart';
import 'package:devquiz/home/home_page.dart';
import 'package:flutter/material.dart';
class SplashPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
Future.delayed(Duration(seconds: 3)).then((_) => Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => HomePage(),
)));
return Scaffold(
body: Container(
decoration: BoxDecoration(gradient: AppGradients.linear),
child: Center(
child: Image.asset(AppImages.logo),
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/welcome_page.dart
|
import 'package:flutter/material.dart';
import 'login_screen.dart';
import 'signup_screen.dart';
class HomeScreenNew extends StatelessWidget {
const HomeScreenNew({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Column(
children: <Widget>[
Text(
"Welcome",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
),
SizedBox(
height: 20,
),
Text(
"Automatic identity verification which enables you to verify your identity",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.grey[700], fontSize: 15),
),
],
),
Container(
height: MediaQuery.of(context).size.height / 3,
decoration: BoxDecoration(
image:
DecorationImage(image: AssetImage('assets/VLogo.png'))),
),
Column(
children: <Widget>[
MaterialButton(
minWidth: double.infinity,
height: 60,
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => LoginPage()));
},
shape: RoundedRectangleBorder(
side: BorderSide(color: Colors.black),
borderRadius: BorderRadius.circular(50)),
child: Text(
"Login",
style:
TextStyle(fontWeight: FontWeight.w600, fontSize: 18),
),
),
SizedBox(
height: 20,
),
Container(
padding: EdgeInsets.only(top: 3, left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
)),
child: MaterialButton(
minWidth: double.infinity,
height: 60,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignupPage()));
},
color: Color.fromARGB(255, 47, 122, 241),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
child: Text(
"Sign up",
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 18),
),
),
)
],
)
],
),
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/HostelMainScreen.dart
|
import 'package:flutter/material.dart';
import 'LeaveRequest/LeaveRequestOptionScreen.dart';
class HostelScreen extends StatefulWidget{
@override
State<HostelScreen> createState() => _HostelScreenState();
}
class _HostelScreenState extends State<HostelScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
backgroundColor: Colors.blue[300],
),
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Column(
children: <Widget>[
//Top Card
Padding(
padding: const EdgeInsets.all(2.0),
child: Card(
elevation: 5.0,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(0),topRight: Radius.circular(0),bottomRight: Radius.circular(60),bottomLeft: Radius.circular(60)),
),
child: Container(
child: Padding(
padding: const EdgeInsets.all(13.0),
child: Text("Hostel",style: TextStyle(
letterSpacing: 2,
fontSize: 40.0,fontFamily: 'Elsie',fontWeight: FontWeight.normal),
textAlign: TextAlign.center,),
),
height: 80.0,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/hostel2.jpg"),
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.6), BlendMode.dstATop),
alignment: Alignment.center,
)
),
),
),
),
// Leave Request
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 150,
// width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.topCenter,
children: [
Container(
color: Colors.white,
),
//TextView
Positioned(
//blue
left: 70,
top: 20,
// replace with your Card here
child: Card(
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
elevation: 5,
child: Container(
width: 275,
height: 120,
color: Colors.white,
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(90, 20, 0, 0),
child: Text("Leave Request",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'MonoRegular',
fontSize: 20.0,
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(155, 28, 0, 0),
child: MaterialButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>LeaveRequestOptionScreen()));
},
// elevation: 10.0,
color: Colors.blue,
height: 48,
minWidth: 120,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(0),bottomRight: Radius.circular(20),bottomLeft: Radius.circular(0)),
),
child: Text("VIEW",
style: TextStyle(
letterSpacing: 2,
fontWeight: FontWeight.bold,
fontFamily: 'Aldrich',
fontSize: 20.0,
),
),
),
)
],
),
),
),
),
//ImageView
Positioned(
top: 5,
left: 40,
// replace with your image here
child: Card(
elevation: 10,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/request2.jpg"),
fit: BoxFit.cover,
),
),),
),),
],
),
),
),
//Hostel Details (about rooms configuration and details)
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 150,
// width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.topCenter,
children: [
Container(
color: Colors.white,
),
//TextView
Positioned(
//blue
left: 70,
top: 20,
// replace with your Card here
child: Card(
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
elevation: 5,
child: Container(
width: 275,
height: 120,
color: Colors.white,
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(90, 20, 0, 0),
child: Text("Hostel Details",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'MonoRegular',
fontSize: 20.0,
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(155, 28, 0, 0),
child: MaterialButton(onPressed: (){},
// elevation: 10.0,
color: Colors.blue,
height: 48,
minWidth: 120,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(0),bottomRight: Radius.circular(20),bottomLeft: Radius.circular(0)),
),
child: Text("VIEW",
style: TextStyle(
letterSpacing: 2,
fontWeight: FontWeight.bold,
fontFamily: 'Aldrich',
fontSize: 20.0,
),
),
),
)
],
),
),
),
),
//ImageView
Positioned(
top: 5,
left: 40,
// replace with your image here
child: Card(
elevation: 10,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/hostel4.jpg"),
fit: BoxFit.cover,
),
),),
),),
],
),
),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/signup_screen.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'welcome_page.dart';
import 'login_screen.dart';
class SignupPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.white,
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
size: 20,
color: Colors.black,
),
), systemOverlayStyle: SystemUiOverlayStyle.dark,
),
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 40),
height: MediaQuery.of(context).size.height - 50,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: <Widget>[
Text(
"Sign up",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
SizedBox(
height: 20,
),
Text(
"Create an account, It's free",
style: TextStyle(fontSize: 15, color: Colors.grey[700]),
),
],
),
Column(
children: <Widget>[
makeInput(label: "Email"),
makeInput(label: "Password", obscureText: true),
makeInput(label: "Confirm Password", obscureText: true),
],
),
Container(
padding: EdgeInsets.only(top: 3, left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
)),
child: MaterialButton(
minWidth: double.infinity,
height: 60,
onPressed: () {
final snackBar = SnackBar(
content: Text('Thanks For Your Sign Up'),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomeScreenNew()),
);
},
color: Colors.greenAccent,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
child: Text(
"Sign up",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Already have an account?"),
GestureDetector(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => LoginPage()));
},
child: Text(
" Login",
style:
TextStyle(fontWeight: FontWeight.w600, fontSize: 18),
),
),
],
),
],
),
),
),
);
}
Widget makeInput({label, obscureText = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
label,
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
),
SizedBox(
height: 5,
),
TextField(
obscureText: obscureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
enabledBorder:
OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border:
OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
),
),
SizedBox(
height: 30,
),
],
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/GradesInformation.dart
|
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'ExamMainScreen.dart';
class GradesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ExamScreen()),
);
},
);
},
),
backgroundColor: Colors.blue[300],
),
body: Container(
margin: EdgeInsets.fromLTRB(0, 50, 0, 0),
height: 500,
width: MediaQuery.of(context).size.width,
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4,
// offset: Offset(-4, 4), // Shadow position
),
],
image: DecorationImage(
image: AssetImage("assets/background1.jpg"),
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.9), BlendMode.dstATop),
alignment: Alignment.center,
),
border: Border.all(
color: Colors.transparent,
),
borderRadius: BorderRadius.all(Radius.circular(60)),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Card(
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(60),
topRight: Radius.circular(60),
bottomRight: Radius.circular(0),
bottomLeft: Radius.circular(0)),
),
child: Container(
child: Center(
child: Padding(
padding: const EdgeInsets.all(13.0),
child: Text(
"Grades Information",
style: TextStyle(
letterSpacing: 1,
fontSize: 37.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
),
),
height: 110,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/topcard6.jpg"),
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.6), BlendMode.dstATop),
alignment: Alignment.center,
)
),
),
),
Card(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(0),
topRight: Radius.circular(0),
bottomRight: Radius.circular(60),
bottomLeft: Radius.circular(60)),
),
child: Container(
height: 320,
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"GRADE",
style: TextStyle(
letterSpacing: 1,
fontSize: 30.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("POINT",
style: TextStyle(
letterSpacing: 1,
fontSize: 30.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Divider(height: 10,thickness: 1.5,color: Colors.black,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
" S",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("10",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"A",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("9",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"B",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("8",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"C",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("7",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"D",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("6",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"E",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("5",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"F",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),
),
Text("0",
style: TextStyle(
letterSpacing: 1,
fontSize: 25.0,
fontFamily: 'Elsie',
fontWeight: FontWeight.normal),),
],
),
],
),
),
),
),
],
),
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/faculty.dart
|
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/material.dart';
class Faculty extends StatefulWidget {
const Faculty({super.key});
@override
State<Faculty> createState() => _FacultyState();
}
class _FacultyState extends State<Faculty> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Faculty List'),
),
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Table(
border: TableBorder.all(),
// defaultColumnWidth: FixedColumnWidth(80),
columnWidths: const {
0: FixedColumnWidth(130),
1: FixedColumnWidth(200),
2: FixedColumnWidth(130),
3: FixedColumnWidth(150),
4: FixedColumnWidth(250),
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
children: [
TableRow(children: [
Center(
child: Text(
'Image',
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Center(
child: Text(
'Faculty Name',
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Center(
child: Text(
'Cabin Number',
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Center(
child: Text(
'Designation',
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Center(
child: Text(
'Email',
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 15),
),
),
],
),
TableRow(children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(child: Icon(Icons.person,color: Colors.white,),backgroundColor: Colors.blueGrey[400],radius: 30,),
)
),
Center(
child: Text(
'Dr. Kanchan Lata Kashyap',
),
),
Center(
child: Text(
'303',
),
),
Center(
child: Text(
'Assistant Professor',
),
),
Center(
child: Text(
'kanchan.k@vitbhopal.ac.in',
),
),
],
),
TableRow(children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(child: Icon(Icons.person,color: Colors.white,),backgroundColor: Colors.blueGrey[400],radius: 30,),
)
),
Center(
child: Text(
'Dr. D. Sarvanan',
),
),
Center(
child: Text(
'502',
),
),
Center(
child: Text(
'Assistant Professor',
),
),
Center(
child: Text(
'd.sarvanan@vitbhopal.ac.in',
),
),
],
),
TableRow(children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(child: Icon(Icons.person,color: Colors.white,),backgroundColor: Colors.blueGrey[400],radius: 30,),
)
),
Center(
child: Text(
'Dr. Prabhu Kanna',
),
),
Center(
child: Text(
'503',
),
),
Center(
child: Text(
'Assistant Professor',
),
),
Center(
child: Text(
'prabhukhanna@vitbhopal.ac.in',
),
),
],
),
TableRow(children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(child: Icon(Icons.person,color: Colors.white,),backgroundColor: Colors.blueGrey[400],radius: 30,),
)
),
Center(
child: Text(
'Dr. Rahul Kumar Chaturvedi',
),
),
Center(
child: Text(
'205',
),
),
Center(
child: Text(
'Assistant Professor',
),
),
Center(
child: Text(
'rahulchaturvedi@vitbhopal.ac.in',
),
),
],
),
TableRow(children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(child: Icon(Icons.person,color: Colors.white,),backgroundColor: Colors.blueGrey[400],radius: 30,),
)
),
Center(
child: Text(
'Dr. Anju Shukla',
),
),
Center(
child: Text(
'404',
),
),
Center(
child: Text(
'Assistant Professor',
),
),
Center(
child: Text(
'anjushukla@vitbhopal.ac.in',
),
),
],
),
TableRow(children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(child: Icon(Icons.person,color: Colors.white,),backgroundColor: Colors.blueGrey[400],radius: 30,),
)
),
Center(
child: Text(
'Dr. Swagat Kumar',
),
),
Center(
child: Text(
'312',
),
),
Center(
child: Text(
'Assistant Professor',
),
),
Center(
child: Text(
'swagatkumar@vitbhopal.ac.in',
),
),
],
),
],
),
),
)
),
)
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/exam.dart
|
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:flutter/material.dart';
class Exam extends StatefulWidget {
const Exam({super.key});
@override
State<Exam> createState() => _ExamState();
}
class _ExamState extends State<Exam> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Course Page'),
),
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Table(
border: TableBorder.all(),
// defaultColumnWidth: FixedColumnWidth(80),
columnWidths: const {
0: FixedColumnWidth(130),
1: FixedColumnWidth(100),
2: FixedColumnWidth(270),
3: FixedColumnWidth(80),
4: FixedColumnWidth(100),
5: FixedColumnWidth(150),
6: FixedColumnWidth(100),
7: FixedColumnWidth(100),
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
children: [
TableRow(
children: [
Center(
child: Text(
'ClassID',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Course Code',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Course Title',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Room ID',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Exam Date',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Timing',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Semester ID',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Center(
child: Text(
'Exam Type',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000810',
),
),
Center(
child: Text(
'MCA1002',
),
),
Center(
child: Text(
'Problem Solving using DSA',
),
),
Center(
child: Text(
'S202',
),
),
Center(
child: Text(
'05-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000312',
),
),
Center(
child: Text(
'MCA1012',
),
),
Center(
child: Text(
'Object Oriented Programming',
),
),
Center(
child: Text(
'S201',
),
),
Center(
child: Text(
'6-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000694',
),
),
Center(
child: Text(
'MCA1001',
),
),
Center(
child: Text(
'Android Programming',
),
),
Center(
child: Text(
'S203',
),
),
Center(
child: Text(
'7-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000231',
),
),
Center(
child: Text(
'MCA1004',
),
),
Center(
child: Text(
'Skills for business communication',
),
),
Center(
child: Text(
'S204',
),
),
Center(
child: Text(
'8-5-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000562',
),
),
Center(
child: Text(
'MCA1005',
),
),
Center(
child: Text(
'Data Mining',
),
),
Center(
child: Text(
'S202',
),
),
Center(
child: Text(
'10-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000616',
),
),
Center(
child: Text(
'MCA1006',
),
),
Center(
child: Text(
'Data Networking',
),
),
Center(
child: Text(
'S201',
),
),
Center(
child: Text(
'11-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000510',
),
),
Center(
child: Text(
'MCA1007',
),
),
Center(
child: Text(
'Competitive Programming',
),
),
Center(
child: Text(
'S204',
),
),
Center(
child: Text(
'12-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000730',
),
),
Center(
child: Text(
'MCA1008',
),
),
Center(
child: Text(
'Web Development',
),
),
Center(
child: Text(
'S203',
),
),
Center(
child: Text(
'13-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
TableRow(
children: [
Center(
child: Text(
'BL2022231000180',
),
),
Center(
child: Text(
'MCA1009',
),
),
Center(
child: Text(
'Software Engineering',
),
),
Center(
child: Text(
'S201',
),
),
Center(
child: Text(
'14-05-2023',
),
),
Center(
child: Text(
'9:15 AM - 12:15 PM',
),
),
Center(
child: Text(
'BL2022231',
),
),
Center(
child: Text(
'TEE',
),
),
],
),
],
),
),
)),
));
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/login_screen.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:ham/modules/MainPage.dart';
import 'signup_screen.dart';
class LoginPage extends StatefulWidget {
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.white,
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
size: 20,
color: Colors.black,
),
), systemOverlayStyle: SystemUiOverlayStyle.dark,
),
body: Container(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: <Widget>[
Text(
"Login",
style: TextStyle(
fontSize: 30, fontWeight: FontWeight.bold),
),
SizedBox(
height: 20,
),
Text(
"Login to your account",
style: TextStyle(fontSize: 15, color: Colors.grey[700]),
),
],
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Column(
children: <Widget>[
makeInput(label: "Email"),
makeInput(label: "Password", obscureText: true),
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3, left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
),
),
child: MaterialButton(
minWidth: double.infinity,
height: 60,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MainPage()));
},
color: Colors.greenAccent,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
child: Text(
"Login",
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 18),
),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Don't have an account?"),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignupPage()));
},
child: Text(
"Sign up",
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 18),
),
),
],
)
],
),
),
Container(
height: MediaQuery.of(context).size.height / 3,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/background.png'),
fit: BoxFit.cover)),
)
],
),
),
);
}
Widget makeInput({label, obscureText = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
label,
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
),
SizedBox(
height: 5,
),
TextField(
obscureText: obscureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
enabledBorder:
OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border:
OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
),
),
SizedBox(
height: 30,
),
],
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/main.dart
|
import 'package:flutter/material.dart';
import 'package:ham/Pages/TimeTable.dart';
import 'package:firebase_core/firebase_core.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TESTING',
// home: MainPage(),
// home: Faculty(),
// home: ExamScreen(),
// home: HostelScreen(),
home: TimeTable(),
// home: DropdownDemo(),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/lib/ExamMainScreen.dart
|
import 'package:flutter/material.dart';
import 'Examination/ExamMarks.dart';
import 'GradesInformation.dart';
class ExamScreen extends StatefulWidget{
@override
State<ExamScreen> createState() => _ExamScreenState();
}
class _ExamScreenState extends State<ExamScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
backgroundColor: Colors.blue[300],
),
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Column(
children: <Widget>[
//Top Card
Padding(
padding: const EdgeInsets.all(2.0),
child: Card(
elevation: 5.0,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(0),topRight: Radius.circular(0),bottomRight: Radius.circular(60),bottomLeft: Radius.circular(60)),
),
child: Container(
child: Padding(
padding: const EdgeInsets.all(13.0),
child: Text("Examination",style: TextStyle(
letterSpacing: 2,
fontSize: 40.0,fontFamily: 'Elsie',fontWeight: FontWeight.normal),
textAlign: TextAlign.center,),
),
height: 80.0,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/topcard6.jpg"),
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.6), BlendMode.dstATop),
alignment: Alignment.center,
)
),
),
),
),
// Exam Marks
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 150,
// width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.topCenter,
children: [
Container(
color: Colors.white,
),
//TextView
Positioned(
//blue
left: 70,
top: 20,
// replace with your Card here
child: Card(
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
elevation: 5,
child: Container(
width: 275,
height: 120,
color: Colors.white,
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(90, 20, 0, 0),
child: Text("Exam Marks",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'MonoRegular',
fontSize: 20.0,
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(155, 28, 0, 0),
child: MaterialButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=> ExamMarksScreen()));
},
// elevation: 10.0,
color: Colors.blue,
height: 48,
minWidth: 120,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(0),bottomRight: Radius.circular(20),bottomLeft: Radius.circular(0)),
),
child: Text("VIEW",
style: TextStyle(
letterSpacing: 2,
fontWeight: FontWeight.bold,
fontFamily: 'Aldrich',
fontSize: 20.0,
),
),
),
)
],
),
),
),
),
//ImageView
Positioned(
top: 5,
left: 40,
// replace with your image here
child: Card(
elevation: 10,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/result3.jpg"),
fit: BoxFit.cover,
),
),),
),),
],
),
),
),
//Grade Calculator
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 150,
// width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.topCenter,
children: [
Container(
color: Colors.white,
),
//TextView
Positioned(
//blue
left: 70,
top: 20,
// replace with your Card here
child: Card(
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
elevation: 5,
child: Container(
width: 275,
height: 120,
color: Colors.white,
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(90, 20, 0, 0),
child: Text("Grade Info",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'MonoRegular',
fontSize: 20.0,
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(155, 28, 0, 0),
child: MaterialButton(onPressed: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => GradesScreen()),
);
},
// elevation: 10.0,
color: Colors.blue,
height: 48,
minWidth: 120,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(0),bottomRight: Radius.circular(20),bottomLeft: Radius.circular(0)),
),
child: Text("VIEW",
style: TextStyle(
letterSpacing: 2,
fontWeight: FontWeight.bold,
fontFamily: 'Aldrich',
fontSize: 20.0,
),
),
),
)
],
),
),
),
),
//ImageView
Positioned(
top: 5,
left: 40,
// replace with your image here
child: Card(
elevation: 10,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black12, //<-- SEE HERE
),
borderRadius: BorderRadius.circular(20.0)
),
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/grades1.jpg"),
fit: BoxFit.cover,
),
),),
),),
],
),
),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/modules/MainPage.dart
|
import 'package:flutter/material.dart';
import 'package:ham/modules/SideBar.dart';
import 'package:ham/modules/homePage.dart';
class MainPage extends StatefulWidget {
@override
State<MainPage> createState() => _MainPageState();
}
class _MainPageState extends State<MainPage>
with SingleTickerProviderStateMixin {
bool isSidebarClosed = true;
// late AnimationController _animationController;
// late Animation<double> animation;
// @override
// void initState() {
// _animationController = AnimationController(
// vsync: this,
// duration: const Duration(milliseconds: 200),
// )..addListener(() {
// setState(() {});
// });
// animation = Tween<double>(begin: 0, end: 1).animate(
// CurvedAnimation(
// parent: _animationController, curve: Curves.fastOutSlowIn),
// );
// super.initState();
// }
// @override
// void dispose() {
// // TODO: implement dispose
// _animationController.dispose();
// super.dispose();
// }
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xff1e212f),
body: Stack(children: [
AnimatedPositioned(
width: 288,
left: isSidebarClosed ? -250 : 0,
height: MediaQuery.of(context).size.height,
duration: const Duration(milliseconds: 500),
curve: Curves.fastLinearToSlowEaseIn,
child: const Statebar(),
),
Transform.translate(
offset: Offset(isSidebarClosed ? 0 : 250, 0),
child: Transform.scale(
scale: isSidebarClosed ? 1 : 0.8,
child: const ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(24)),
child: HomePage()),
),
),
AnimatedPositioned(
duration: Duration(milliseconds: 200),
left: isSidebarClosed ? 0 : 200,
child: SafeArea(
child: Container(
margin: EdgeInsets.only(left: 30, top: 55),
height: 40,
width: 40,
decoration: const BoxDecoration(
color: Color.fromARGB(255, 217, 212, 212),
shape: BoxShape.circle,
),
child: IconButton(
icon: Icon(
Icons.list_outlined,
),
onPressed: () {
if (isSidebarClosed) {
setState(() {
isSidebarClosed = false;
});
} else {
setState(() {
isSidebarClosed = true;
});
}
}),
),
),
),
]),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/modules/SideBar.dart
|
import 'package:flutter/material.dart';
import 'package:ham/ExamMainScreen.dart';
import 'package:ham/HostelMainScreen.dart';
import 'package:ham/Pages/TimeTable.dart';
import 'package:ham/Pages/Course.dart';
import 'package:ham/exam.dart';
import 'package:ham/faculty.dart';
import 'package:ham/modules/MainPage.dart';
class Statebar extends StatefulWidget {
const Statebar({super.key});
@override
State<Statebar> createState() => _StatebarState();
}
void buttonicon() {}
class _StatebarState extends State<Statebar> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xff1e212f),
body: Container(
width: 288,
height: double.infinity,
//color: Color(0xff1e212f),
padding: EdgeInsets.only(top: 100),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: const [
Padding(padding: EdgeInsets.only(left: 30)),
Text(
'BROWSE',
style: TextStyle(
color: Color(0xff8e8f9d),
fontSize: 20,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.right,
),
SizedBox(height: 10),
],
),
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
SizedBox(height: 10),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MainPage()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/home.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Home',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
// Padding(
// padding: EdgeInsets.only(left: 10, bottom: 15),
// child: Divider(
// height: 5,
// color: Color(0xff353847),
// ),
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Padding(padding: EdgeInsets.only(left: 20)),
// InkWell(
// splashColor: Colors.blue,
// borderRadius: BorderRadius.circular(15),
// onTap: () {
// print('Button press');
// },
// child: SizedBox(
// height: 50,
// width: 250,
// child: Column(
// children: [
// Padding(padding: EdgeInsets.only(top: 5)),
// Row(
// children: [
// Padding(
// padding: EdgeInsets.only(left: 10),
// ),
// Ink.image(
// image: AssetImage('assets/profile.png'),
// height: 34,
// width: 34,
// fit: BoxFit.cover,
// ),
// SizedBox(
// width: 10,
// ),
// const Text(
// 'Profile',
// style: TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 20,
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// ),
// ],
// ),
Padding(
padding: EdgeInsets.only(left: 10, bottom: 15),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const TimeTable()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/cal.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Time Table',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
Padding(
padding: EdgeInsets.only(left: 10, bottom: 15),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Course()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/acadamic.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Course',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
Padding(
padding: EdgeInsets.only(left: 10, bottom: 15),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Exam()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/exam.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Exam',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
Padding(
padding: EdgeInsets.only(left: 10, bottom: 15),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ExamScreen()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/vtop.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Marks',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
Padding(
padding: EdgeInsets.only(left: 10, bottom: 15),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HostelScreen()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/hostle.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Hostel',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
Padding(
padding: EdgeInsets.only(left: 10, bottom: 15),
child: Divider(
height: 5,
color: Color(0xff353847),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.only(left: 20)),
InkWell(
splashColor: Colors.blue,
borderRadius: BorderRadius.circular(15),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Faculty()),
);
},
child: SizedBox(
height: 50,
width: 250,
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 10),
),
Ink.image(
image: AssetImage('assets/proctor.png'),
height: 34,
width: 34,
fit: BoxFit.cover,
),
SizedBox(
width: 10,
),
const Text(
'Proctor',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
],
),
],
),
),
),
],
),
// Padding(
// padding: EdgeInsets.only(left: 10, bottom: 15),
// child: Divider(
// height: 5,
// color: Color(0xff353847),
// ),
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Padding(padding: EdgeInsets.only(left: 20)),
// InkWell(
// splashColor: Colors.blue,
// borderRadius: BorderRadius.circular(15),
// onTap: () {
// print('Button press');
// },
// child: SizedBox(
// height: 50,
// width: 250,
// child: Column(
// children: [
// Padding(padding: EdgeInsets.only(top: 5)),
// Row(
// children: [
// Padding(
// padding: EdgeInsets.only(left: 10),
// ),
// Ink.image(
// image: AssetImage('assets/account.png'),
// height: 34,
// width: 34,
// fit: BoxFit.cover,
// ),
// SizedBox(
// width: 10,
// ),
// const Text(
// 'My Account',
// style: TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 20,
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// ),
// ],
// ),
],
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/modules/CDownloader.dart
|
import 'package:dio/dio.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:gallery_saver/gallery_saver.dart';
import 'package:path_provider/path_provider.dart';
class CFileDownloader extends StatefulWidget {
@override
State<CFileDownloader> createState() => _FileDownloaderState();
}
class _FileDownloaderState extends State<CFileDownloader> {
Future<ListResult>? futureFiles =
FirebaseStorage.instance.ref('/course').list();
Map<int, double> downloadProgress = {};
// @override
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: FutureBuilder<ListResult>(
future: futureFiles,
builder: ((context, snapshot) {
if (snapshot.hasData) {
final files = snapshot.data!.items;
return ListView.builder(
itemCount: files.length,
itemBuilder: (context, index) {
final file = files[index];
double? progress = downloadProgress[index];
return ListTile(
title: Text(
file.name,
style: TextStyle(
fontSize: 18,
),
),
subtitle: progress != null
? LinearProgressIndicator(
value: progress,
backgroundColor: Colors.black26,
)
: null,
trailing: IconButton(
icon: Icon(
Icons.download,
),
onPressed: () {
download(index, file);
},
),
);
},
);
} else if (snapshot.hasError) {
return const Center(
child: Text("Errors...."),
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
}),
),
),
);
}
Future download(int index, Reference ref) async {
final url = await ref.getDownloadURL();
final tempDir = await getTemporaryDirectory();
final path = '${tempDir.path}/${ref.name}';
await Dio().download(url, path, onReceiveProgress: (received, total) {
double progress = received / total;
setState(() {
downloadProgress[index] = progress;
});
});
await GallerySaver.saveImage(path, toDcim: true);
// final dir = await getApplicationDocumentsDirectory();
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text('Download & saved to Gallery')));
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/modules/homePage.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: double.infinity,
child: Column(
children: [
// Padding(
// padding: EdgeInsets.only(top: 100, left: 90),
// child: Title(
// color: Colors.black,
// child: Text(
// 'Welcome To VTOP',
// style: TextStyle(fontSize: 20),
// ),
// ),
// ),
Container(
margin: EdgeInsets.only(top: 100),
// height: MediaQuery.of(context).size.height / 3,
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage('assets/welcome.png')),
),
child: ListTile(
title: Padding(
padding: const EdgeInsets.only(top: 450),
child: Text(
'“Inspiration does exist, but it must find you working."',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
textAlign: TextAlign.center,
),
),
subtitle: Text(
'-Pablo Picasso',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 19),
textAlign: TextAlign.center,
),
),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/modules/FileDownloader.dart
|
import 'package:dio/dio.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:gallery_saver/gallery_saver.dart';
import 'package:path_provider/path_provider.dart';
class FileDownloader extends StatefulWidget {
@override
State<FileDownloader> createState() => _FileDownloaderState();
}
class _FileDownloaderState extends State<FileDownloader> {
Future<ListResult>? futureFiles =
FirebaseStorage.instance.ref('/files').list();
Map<int, double> downloadProgress = {};
var vis = false;
// @override
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: FutureBuilder<ListResult>(
future: futureFiles,
builder: ((context, snapshot) {
if (snapshot.hasData) {
final files = snapshot.data!.items;
return ListView.builder(
itemCount: files.length,
itemBuilder: (context, index) {
final file = files[index];
double? progress = downloadProgress[index];
return ListTile(
// title: Text(
// 'Time Table',
// style: TextStyle(
// fontSize: 20,
// ),
// ),
subtitle: progress != null
? LinearProgressIndicator(
value: progress,
backgroundColor: Colors.black26,
)
: null,
title: TextButton(
onPressed: () {
download(index, file);
},
child: Text('Download Full Time Table')),
);
},
);
} else if (snapshot.hasError) {
return const Center(
child: Text("Errors...."),
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
}),
),
),
);
}
Future download(int index, Reference ref) async {
final url = await ref.getDownloadURL();
final tempDir = await getTemporaryDirectory();
final path = '${tempDir.path}/${ref.name}';
await Dio().download(url, path, onReceiveProgress: (received, total) {
double progress = received / total;
setState(() {
downloadProgress[index] = progress;
});
});
await GallerySaver.saveImage(path, toDcim: true);
// final dir = await getApplicationDocumentsDirectory();
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text('Download & saved to Gallery')));
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/modules/DataFetch.dart
|
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:ham/Pages/TimeTable.dart';
class DataFetch extends StatelessWidget {
//to access the different database
final Query<Map<String, dynamic>> _timetable2 =
FirebaseFirestore.instance.collection('mon').orderBy('num');
final Query<Map<String, dynamic>> _timetable3 =
FirebaseFirestore.instance.collection('tue').orderBy('num');
final Query<Map<String, dynamic>> _timetable4 =
FirebaseFirestore.instance.collection('wed').orderBy('num');
final Query<Map<String, dynamic>> _timetable5 =
FirebaseFirestore.instance.collection('ths').orderBy('num');
final Query<Map<String, dynamic>> _timetable6 =
FirebaseFirestore.instance.collection('fri').orderBy('num');
final Query<Map<String, dynamic>> _timetable7 =
FirebaseFirestore.instance.collection('weekend');
final int weekdayvalue;
DataFetch(this.weekdayvalue);
setvauedd() {
if (weekdayvalue == 1) {
return _timetable2;
} else if (weekdayvalue == 2) {
return _timetable3;
} else if (weekdayvalue == 3) {
return _timetable4;
} else if (weekdayvalue == 4) {
return _timetable5;
} else if (weekdayvalue == 5) {
return _timetable6;
} else if (weekdayvalue == 6 || weekdayvalue == 7) {
return _timetable7;
}
}
//main code
@override
Widget build(BuildContext context) {
return Scaffold(
body: StreamBuilder(
stream: setvauedd().snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
return ListView.builder(
itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index) {
final DocumentSnapshot documentSnapshot =
snapshot.data!.docs[index];
return Card(
margin: const EdgeInsets.all(10),
child: ListTile(
title: Text(documentSnapshot['title'],
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
trailing: Text(documentSnapshot['class']),
subtitle: Text(
documentSnapshot['time'],
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
),
);
},
);
},
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/Pages/TimeTable.dart
|
import 'package:date_picker_timeline/date_picker_widget.dart';
import 'package:date_picker_timeline/date_picker_timeline.dart';
import 'package:flutter/material.dart';
import 'package:ham/modules/FileDownloader.dart';
import 'package:ham/modules/DataFetch.dart';
class TimeTable extends StatefulWidget {
const TimeTable({super.key});
@override
State<TimeTable> createState() => _TimeTableState();
}
class _TimeTableState extends State<TimeTable> {
DateTime selectedValue = DateTime.now();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Time Table')),
body: Column(
children: [
SizedBox(
height: 20,
),
Container(
child: DatePicker(
DateTime.now(),
height: 100,
width: 60,
initialSelectedDate: DateTime.now(),
selectionColor: Color.fromARGB(255, 71, 154, 222),
selectedTextColor: Colors.white,
onDateChange: (date) {
setState(() {
selectedValue = date;
// print(selectedValue.weekday);
});
},
),
),
Container(
child: SizedBox(
child: DataFetch(selectedValue.weekday),
height: 520,
),
),
Container(
child: SizedBox(
child: FileDownloader(),
height: 70,
),
)
],
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/Pages/Course.dart
|
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:ham/modules/FileDownloader.dart';
import '../modules/CDownloader.dart';
class Course extends StatefulWidget {
const Course({Key? key}) : super(key: key);
@override
State<Course> createState() => _CourseState();
}
class _CourseState extends State<Course> {
String dropdownValue = 'Summer Semester';
String dropdownValue1 = 'MCA';
late String sname = '';
late String cname = 'MCA';
showData() {
if (sname == 'Winter Semester' && cname == 'MCA') {
return CFileDownloader();
} else {
return Text(
'No Data Available To Display',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.red,
),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Course Page View'),
),
body: Center(
child: Column(
children: [
SizedBox(
height: 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// CrossAxisAlignment.stretch;
Padding(
padding: const EdgeInsets.only(left: 30),
child: Text(
'Semester Name',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.justify,
),
),
Padding(
padding: const EdgeInsets.only(left: 30, right: 30),
child: DropdownButton<String>(
// d
isExpanded: true,
value: dropdownValue,
items: <String>[
'Summer Semester',
'Fall Semester',
'Winter Semester'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: TextStyle(fontSize: 16),
),
);
}).toList(),
onChanged: (String? newValue) {
setState(() {
dropdownValue = newValue!;
sname = newValue;
});
},
),
),
SizedBox(
height: 18,
),
Padding(
padding: const EdgeInsets.only(left: 30),
child: Text(
'Course',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.justify,
),
),
Padding(
padding: const EdgeInsets.only(left: 30, right: 30),
child: DropdownButton<String>(
// d
isExpanded: true,
value: dropdownValue1,
items: <String>['MCA', 'B.Tech', 'M.Tech']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: TextStyle(fontSize: 16),
),
);
}).toList(),
onChanged: (String? newValue) {
setState(() {
dropdownValue1 = newValue!;
cname = newValue;
});
},
),
),
SizedBox(
height: 20,
),
],
),
SizedBox(
child: Container(
// decoration: BoxDecoration(color: Colors.black12),
padding: const EdgeInsets.all(16.0),
child: showData(),
height: 500,
),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/LeaveRequest/ApplyLeaveRequestScreen.dart
|
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class ApplyLeaveRequestScreen extends StatefulWidget {
const ApplyLeaveRequestScreen({Key? key}) : super(key: key);
@override
State<ApplyLeaveRequestScreen> createState() =>
_ApplyLeaveRequestScreenState();
}
class _ApplyLeaveRequestScreenState extends State<ApplyLeaveRequestScreen> {
final _formKey = GlobalKey<FormState>();
String _visitingPlace = '';
String _reason = '';
String? _leaveType;
DateTime? _selectedDate;
TimeOfDay? _selecetedTime;
List<String> _leaveOptions = [
'SPECIAL OUTING',
'WITH PARENT LEAVE',
'OFFICIAL LEAVES(GATE/CAMPUS INTERVIEW)',
'SUMMER VACATION',
'HOME TOWN',
'EMERGENCY LEAVE',
'LOCAL GUARDIAN',
'OUTING',
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Apply leave request"),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Column(
children: [
Form(
key: _formKey,
child: Column(
children: [
SizedBox(
height: 20,
),
Text("HOD NAME: KANCHAN LATA KASHYAP(100064)",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15,letterSpacing: 1),),
SizedBox(
height: 50,
),
Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
child: DropdownButton<String>(
alignment: Alignment.center,
iconSize: 24.0,
icon: Icon(
Icons.keyboard_arrow_down_rounded,
),
underline: Container(
height: 2,
color: Colors.lightBlueAccent,
),
hint: Text(
"---Select leave type---",
style: TextStyle(fontSize: 20, letterSpacing: 5),
),
value: _leaveType,
onChanged: (newValue) {
setState(() {
_leaveType = newValue;
});
},
items: _leaveOptions.map((option) {
return DropdownMenuItem(
child: Text(
option,
style: TextStyle(
fontSize: 15, letterSpacing: 1),
),
value: option,
);
}).toList(),
),
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (value) {
setState(() {
_visitingPlace = value;
});
},
decoration: InputDecoration(
labelText: "Visiting Place",
contentPadding:
EdgeInsets.symmetric(vertical: 0, horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(5)),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(5)),
filled: true,
fillColor: Colors.white,
hintText: 'Enter Place',
),
validator: (value) {
if (value!.isEmpty || value == null) {
return 'Pleas select visiting place';
} else {
return null;
}
},
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (value) {
setState(() {
_reason = value;
});
},
decoration: InputDecoration(
labelText: 'Reason',
contentPadding:
EdgeInsets.symmetric(vertical: 0, horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(5)),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(5)),
filled: true,
fillColor: Colors.white,
hintText: 'Enter Reason',
),
validator: (value) {
if (value!.isEmpty) {
return 'Fill the reason';
}
return null;
},
),
SizedBox(
height: 20,
),
],
),
),
SizedBox(height: 20,),
Align(
child: Text(
"From: ",
style: TextStyle(fontSize: 20),
),
alignment: Alignment.topLeft,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(DateFormat('MMMM d, yyyy - hh:mm a')
.format(selectedFromDate)),
TextButton(
onPressed: () async {
await _selectDate(context);
await _selectTime(context);
},
child: Text(
'Choose Date',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
],
),
SizedBox(height: 20,),
Align(
child: Text(
"To: ",
style: TextStyle(fontSize: 20),
),
alignment: Alignment.topLeft,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(DateFormat('MMMM d, yyyy - hh:mm a')
.format(selectedToDate)),
TextButton(
onPressed: () async {
await _selectToDate(context);
await _selectToTime(context);
},
child: Text(
'Choose Date',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
],
),
SizedBox(
height: 10,
),
SizedBox(height: 20),
MaterialButton(
onPressed: () {
if (_leaveType == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Choose Leave type')),
);
} else if (_formKey.currentState!.validate()) {
// If the form is valid, display a snackbar. In the real world,
// you'd often call a server or save the information in a database.
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Processing Data')),
);
}
},
minWidth: 250,
height: 60,
color: Colors.blue[400],
elevation: 10,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
child: Text(
'SUBMIT LEAVE',
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18,letterSpacing: 4),
),
),
],
),
),
),
),
);
}
DateTime selectedFromDate = DateTime.now();
Future<void> _selectDate(BuildContext context) async {
final DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1900),
lastDate: DateTime(2100),
);
if (pickedDate != null && pickedDate != selectedFromDate) {
setState(() {
selectedFromDate = pickedDate;
});
}
}
Future<void> _selectTime(BuildContext context) async {
final TimeOfDay? pickedFromTime = await showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
);
if (pickedFromTime != null) {
setState(() {
selectedFromDate = DateTime(
selectedFromDate.year,
selectedFromDate.month,
selectedFromDate.day,
pickedFromTime.hour,
pickedFromTime.minute,
);
});
}
}
DateTime selectedToDate = DateTime.now();
Future<void> _selectToDate(BuildContext context) async {
final DateTime? pickedtoDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1900),
lastDate: DateTime(2100),
);
if (pickedtoDate != null && pickedtoDate != selectedToDate) {
setState(() {
selectedToDate = pickedtoDate;
});
}
}
Future<void> _selectToTime(BuildContext context) async {
final TimeOfDay? pickedToTime = await showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
);
if (pickedToTime != null) {
setState(() {
selectedFromDate = DateTime(
selectedFromDate.year,
selectedFromDate.month,
selectedFromDate.day,
pickedToTime.hour,
pickedToTime.minute,
);
});
}
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/LeaveRequest/LeaveRequestOptionScreen.dart
|
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'ApplyLeaveRequestScreen.dart';
import 'LeaveHistory.dart';
import 'LeaveStatus.dart';
class LeaveRequestOptionScreen extends StatefulWidget {
const LeaveRequestOptionScreen({Key? key}) : super(key: key);
@override
State<LeaveRequestOptionScreen> createState() => _LeaveRequestOptionScreenState();
}
class _LeaveRequestOptionScreenState extends State<LeaveRequestOptionScreen> {
@override
Widget build(BuildContext context) {
double myHeight = MediaQuery.of(context).size.height;
double myWidth = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(
title: Text("Hostel Leave Request Screen",textAlign: TextAlign.center,),
),
body: Align(
alignment: Alignment.topCenter,
child: Column(
mainAxisAlignment : MainAxisAlignment.center,
children: [
MaterialButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>ApplyLeaveRequestScreen()));
},
minWidth: myWidth*0.6,
height: 60,
color: Colors.lightBlue[300],
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
child: Text('LEAVE REQUEST',style: TextStyle(letterSpacing: 2,fontWeight: FontWeight.bold,fontSize: 20),),
),
SizedBox(height: myHeight*0.08,),
MaterialButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>LeaveStatusScreen()));
},
minWidth: myWidth*0.6,
height: 60,
color: Colors.lightBlue[300],
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
child: Text('LEAVE STATUS',style: TextStyle(letterSpacing: 2,fontWeight: FontWeight.bold,fontSize: 20)),
),
SizedBox(height: myHeight*0.08,),
MaterialButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>LeaveHistory()));
},
minWidth: myWidth*0.6,
height: 60,
color: Colors.lightBlue[300],
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
child: Text('LEAVE HISTORY',style: TextStyle(letterSpacing: 2,fontWeight: FontWeight.bold,fontSize: 20)),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/LeaveRequest/LeaveStatus.dart
|
import 'package:flutter/material.dart';
class LeaveStatusScreen extends StatefulWidget {
const LeaveStatusScreen({Key? key}) : super(key: key);
@override
State<LeaveStatusScreen> createState() => _LeaveStatusScreen();
}
List<String> leaveId = [
'L0762121',
];
List<String> visitPlace = [
'SEHORE',
];
List<String> reason = [
'Diwali Vacation',
];
List<String> leaveOptions = [
'SPECIAL OUTING',
];
List<String> fromDate = [
'07-MAR-2023 02:30 PM',
];
List<String> toDate = [
'07-MAR-2023 07:30 PM',
];
List<String> status = [
'REQUEST APPROVED',
];
List<String> remarks = [
'Dear Hostel Team, Kindly do the needful. by [ 100424 ] [ SOMA SAHA ]',
];
class _LeaveStatusScreen extends State<LeaveStatusScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Leave Status",textAlign: TextAlign.center,),
),
body: Container(
child: ListView.builder(itemBuilder: (context,index){
return Card(
margin: EdgeInsets.all(10),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
color: Colors.lightBlue[100],
elevation: 5,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Leave Id: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(leaveId[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Visit Palce: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(visitPlace[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Reason: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(reason[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("From: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(fromDate[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("To: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(toDate[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Status: ",style: TextStyle(fontWeight: FontWeight.bold),),
Flexible(child: Text(status[index],maxLines: 1,overflow: TextOverflow.ellipsis,style: TextStyle(color: Colors.green),),),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Remark: ",style: TextStyle(fontWeight: FontWeight.bold),),
Flexible(child: Text(remarks[index],maxLines: 1,overflow: TextOverflow.ellipsis,)),
],
),
),
],
),
),
);
},
itemCount: leaveId.length,),
)
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/LeaveRequest/LeaveHistory.dart
|
import 'package:flutter/material.dart';
class LeaveHistory extends StatefulWidget {
const LeaveHistory({Key? key}) : super(key: key);
@override
State<LeaveHistory> createState() => _LeaveHistoryState();
}
List<String> leaveId = [
'L0762121',
'L0757121',
'L0766732',
'L0759090',
'L0730449',
];
List<String> visitPlace = [
'SEHORE',
'DELHI',
'BHOPAL',
'MUMBAI',
'INDORE',
];
List<String> reason = [
'Diwali Vacation',
'Winter Vacation',
'Medical Issue',
'Family Visit',
'Summer Vacation',
];
List<String> leaveOptions = [
'SPECIAL OUTING',
'WITH PARENT LEAVE',
'OFFICIAL LEAVES(GATE/CAMPUS INTERVIEW)',
'SUMMER VACATION',
'HOME TOWN',
'EMERGENCY LEAVE',
'LOCAL GUARDIAN',
'OUTING',
];
List<String> fromDate = [
'07-MAR-2023 02:30 PM',
'03-FEB-2023 12:30 PM',
'13-JAN-2023 07:45 AM',
'20-DEC-2022 03:00 PM',
'22-OCT-2022 02:00 PM',
];
List<String> toDate = [
'07-MAR-2023 07:30 PM',
'13-FEB-2023 08:45 AM',
'13-JAN-2023 07:45 PM',
'03-JAN-2023 07:00 AM',
'02-NOV-2022 11:00 AM',
];
List<String> status = [
'REQUEST APPROVED',
'REQUEST CANCELLED AFTER APPROVAL/REJECTION',
'REQUEST APPROVED BY PROCTOR & WAITING FOR WARDEN APPROVAL',
'REQUEST APPROVED BY PROCTOR & WAITING FOR WARDEN APPROVAL',
'REQUEST APPROVED BY PROCTOR & WAITING FOR WARDEN APPROVAL',
];
List<String> remarks = [
'Dear Hostel Team, Kindly do the needful. by [ 100424 ] [ SOMA SAHA ]',
'Dear Hostel Team, Kindly do the needful. by [ 100424 ] [ SOMA SAHA ]',
'Dear Hostel Team, Kindly do the needful. by [ 100424 ] [ SOMA SAHA ]',
'Dear Hostel Team, Kindly do the needful. by [ 100424 ] [ SOMA SAHA ]',
'Dear Hostel Team, Kindly do the needful. by [ 100424 ] [ SOMA SAHA ]',
];
class _LeaveHistoryState extends State<LeaveHistory> {
@override
Widget build(BuildContext context) {
double myHeight = MediaQuery.of(context).size.height;
double myWidth = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(
title: Text("Leave History",textAlign: TextAlign.center,),
),
body: Container(
child: ListView.builder(itemBuilder: (context,index){
return Card(
margin: EdgeInsets.all(10),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
color: Colors.lightBlue[100],
elevation: 5,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Leave Id: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(leaveId[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Visit Palce: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(visitPlace[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Reason: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(reason[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("From: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(fromDate[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("To: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text(toDate[index]),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Status: ",style: TextStyle(fontWeight: FontWeight.bold),),
Flexible(child: Text(status[index],maxLines: 1,overflow: TextOverflow.ellipsis,)),
],
),
),
Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Text("Remark: ",style: TextStyle(fontWeight: FontWeight.bold),),
Flexible(child: Text(remarks[index],maxLines: 1,overflow: TextOverflow.ellipsis,)),
],
),
),
],
),
),
);
},
itemCount: leaveId.length,),
)
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/Examination/ExamMarks.dart
|
import 'package:flutter/material.dart';
import 'SelectedSubject.dart';
class ExamMarksScreen extends StatefulWidget {
const ExamMarksScreen({Key? key}) : super(key: key);
@override
State<ExamMarksScreen> createState() => _ExamMarksScreenState();
}
class _ExamMarksScreenState extends State<ExamMarksScreen> {
String? _examType;
List<String> _examOptions = [
'Tri Semester III & VI 2022-23',
"Winter Inter Semester - II 2022-23",
"Summer Semester 2022-23",
"Winter Inter Semester - | 2022-23",
"Tri Semester II & V 2022-23",
"INTERIM SEMESTER 2022-23",
"Winter Semester 2022-23",
"Tri Semester I & IV 2022-23",
"Summer Semester - II 2021-22",
"Summer Semester 2021-22",
"Fall Semester 2022-23",
"Winter Inter Semester - II 2021-22",
"Winter Semester 2021-22",
"Winter Inter Semester - I 2021-22",
"Fall Semester 2021-22",
"INTERIM SEMESTER 2021-22",
"Winter Semester 2020-21",
"Inter Session Semester 2020-21",
"Fall Semester 2020-21",
"Summer Semester 2020-21",
"Summer Semester 2019-20",
"Winter Semester 2019-20",
"Fall Semester 2019-20",
"Fall Semester 2018-19",
"Summer Semester 2018-19",
"Winter Semester 2017-18",
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Select Semester"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
child: DropdownButton<String>(
alignment: Alignment.center,
iconSize: 24.0,
icon: Icon(
Icons.keyboard_arrow_down_rounded,
),
underline: Container(
height: 1,
color: Colors.lightBlueAccent,
),
hint: Text(
"---Choose Semester---",
style: TextStyle(fontSize: 20, letterSpacing: 5),
),
value: _examType,
onChanged: (newValue) {
setState(() {
_examType = newValue;
});
},
items: _examOptions.map((option) {
return DropdownMenuItem(
child: Text(
option,
style: TextStyle(fontSize: 15, letterSpacing: 1),
),
value: option,
);
}).toList(),
),
),
SizedBox(height: 50,),
MaterialButton(
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context)=> SelectSubject()));
},
minWidth: 250,
height: 50,
color: Colors.blue[400],
elevation: 10,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
child: Text(
'SUBMIT',
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18,letterSpacing: 4),
),
),
],
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/Examination/SelectedSubject.dart
|
import 'package:flutter/material.dart';
import 'SelectedSubjects.dart';
class SelectSubject extends StatefulWidget {
const SelectSubject({Key? key}) : super(key: key);
@override
State<SelectSubject> createState() => _SelectSubject();
}
class _SelectSubject extends State<SelectSubject> {
String? _subjectType;
List<String> _subjectOptions = [
'Object Oriented Programing',
"Operating System",
"Data Structure & Algorithm",
"DBMS",
"Soft Skills",
"Communicative English",
"Mathematics",
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Select Subject"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
child: DropdownButton<String>(
alignment: Alignment.center,
iconSize: 24.0,
icon: Icon(
Icons.keyboard_arrow_down_rounded,
),
underline: Container(
height: 1,
color: Colors.lightBlueAccent,
),
hint: Text(
"---Choose Subject---",
style: TextStyle(fontSize: 20, letterSpacing: 5),
),
value: _subjectType,
onChanged: (newValue) {
setState(() {
_subjectType = newValue;
});
},
items: _subjectOptions.map((option) {
return DropdownMenuItem(
child: Text(
option,
style: TextStyle(fontSize: 15, letterSpacing: 1),
),
value: option,
);
}).toList(),
),
),
SizedBox(height: 50,),
MaterialButton(
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context)=> SelectedSubjectScreen()));
},
minWidth: 250,
height: 50,
color: Colors.blue[400],
elevation: 10,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
child: Text(
'SUBMIT',
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18,letterSpacing: 4),
),
),
],
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application/lib
|
mirrored_repositories/VTOP-Mobile-Application/lib/Examination/SelectedSubjects.dart
|
import 'package:flutter/material.dart';
class SelectedSubjectScreen extends StatefulWidget {
const SelectedSubjectScreen({Key? key}) : super(key: key);
@override
State<SelectedSubjectScreen> createState() => _SelectedSubjectScreenState();
}
class _SelectedSubjectScreenState extends State<SelectedSubjectScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Subject Marks",
textAlign: TextAlign.center,
),
),
body: Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
children: [
SizedBox(height: 40,),
Container(
color: Colors.grey[200],
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Sl. No: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("1"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Class. No: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("BL2022231000790"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Course Code: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("MCA1003"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Course Title: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("Object Oriented Programming using Java"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Course Type: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("Lecture and Tutorial ,practical hours only"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Course System: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("CAL"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Faculty: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("KANCHAN LATA KASHYAP"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Slot: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("A11+A12+A13"),
],
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Row(
children: [
Text("Course Mode: ",style: TextStyle(fontWeight: FontWeight.bold),),
Text("LTPM"),
],
),
),
],
),
),
SizedBox(height: 70,),
Card(
elevation: 5,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(border: TableBorder.all(
color: Colors.grey,
width: 1.0,
style: BorderStyle.solid,
borderRadius: BorderRadius.circular(3)
),
dividerThickness: 1.0,
dataRowHeight: 50.0,
columnSpacing: 8.0,
horizontalMargin: 16.0,
columns: <DataColumn>[
DataColumn(
label: Text('Sl. No.'),
tooltip: 'Sl. No.',
),
DataColumn(
label: Text('Mark Title'),
tooltip: 'Mark Title',
),
DataColumn(
label: Text('Max. Mark'),
tooltip: 'Max. Mark',
),
DataColumn(
label: Text('Weighted %'),
tooltip: 'Weighted %',
),
DataColumn(
label: Text('Status'),
tooltip: 'Status',
),
DataColumn(
label: Text('Scored Mark'),
tooltip: 'Scored Mark',
),
DataColumn(
label: Text('Weighted Mark'),
tooltip: 'Weighted Mark',
),
DataColumn(
label: Text('Class Average'),
tooltip: 'Class Average',
),
],
rows: <DataRow>[
DataRow(
cells: <DataCell>[
DataCell(Text('1')),
DataCell(Text('Class Assesment - Tutorial')),
DataCell(Text('5')),
DataCell(Text('5')),
DataCell(Text('Present')),
DataCell(Text('5')),
DataCell(Text('5')),
DataCell(Text('-')),
],
),
DataRow(
cells: <DataCell>[
DataCell(Text('2')),
DataCell(Text('Class Assesment - Group Activity')),
DataCell(Text('5')),
DataCell(Text('5')),
DataCell(Text('Present')),
DataCell(Text('4.75')),
DataCell(Text('4.75')),
DataCell(Text('-')),
],
),
DataRow(
cells: <DataCell>[
DataCell(Text('3')),
DataCell(Text('Lab Assessment - Continuous Assessment')),
DataCell(Text('10')),
DataCell(Text('10')),
DataCell(Text('Present')),
DataCell(Text('9.5')),
DataCell(Text('9.5')),
DataCell(Text('-')),
],
),
],
),
),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/VTOP-Mobile-Application
|
mirrored_repositories/VTOP-Mobile-Application/test/widget_test.dart
|
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ham/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0
|
mirrored_repositories/Favorite-Places-App
|
mirrored_repositories/Favorite-Places-App/lib/main.dart
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/material.dart';
import 'package:favorite_places/screens/places.dart';
final colorScheme = ColorScheme.fromSeed(
brightness: Brightness.dark,
seedColor: const Color.fromARGB(255, 102, 6, 247),
background: const Color.fromARGB(255, 56, 49, 66),
);
final theme = ThemeData().copyWith(
useMaterial3: true,
scaffoldBackgroundColor: colorScheme.background,
colorScheme: colorScheme,
textTheme: GoogleFonts.ubuntuCondensedTextTheme().copyWith(
titleSmall: GoogleFonts.ubuntuCondensed(
fontWeight: FontWeight.bold,
),
titleMedium: GoogleFonts.ubuntuCondensed(
fontWeight: FontWeight.bold,
),
titleLarge: GoogleFonts.ubuntuCondensed(
fontWeight: FontWeight.bold,
),
),
);
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
const ProviderScope(child: MyApp()),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Great Places',
theme: theme,
home: const PlacesScreen(),
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/widgets/location_input.dart
|
import 'dart:convert';
import 'package:favorite_places/models/place.dart';
import 'package:favorite_places/screens/map.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
import 'package:http/http.dart' as http;
class LocationInput extends StatefulWidget {
const LocationInput({super.key, required this.onSelectLocation});
final void Function(PlaceLocation location) onSelectLocation;
@override
State<LocationInput> createState() {
return _LocationInputState();
}
}
class _LocationInputState extends State<LocationInput> {
PlaceLocation? _pickedLocation;
var _isGettingLocation = false;
String get locationImage {
if (_pickedLocation == null) return '';
final lat = _pickedLocation!.latitude;
final lng = _pickedLocation!.longitude;
return 'https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng=&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7Clabel:A%7C$lat,$lng&key=api_key';
}
Future<void> _savePlace(double latitude, double longitude) async {
final url = Uri.parse(
'https://maps.googleapis.com/maps/api/geocode/json?latlng=$latitude,$longitude&key=api_key');
final response = await http.get(url);
final resData = json.decode(response.body);
final address = resData['results'][0]['formatted_address'];
setState(() {
_pickedLocation = PlaceLocation(
latitude: latitude,
longitude: longitude,
address: address,
);
_isGettingLocation = false;
});
widget.onSelectLocation(_pickedLocation!);
}
void _getCurrentLocation() async {
Location location = Location();
bool serviceEnabled;
PermissionStatus permissionGranted;
LocationData locationData;
serviceEnabled = await location.serviceEnabled();
if (!serviceEnabled) {
serviceEnabled = await location.requestService();
if (!serviceEnabled) {
return;
}
}
permissionGranted = await location.hasPermission();
if (permissionGranted == PermissionStatus.denied) {
permissionGranted = await location.requestPermission();
if (permissionGranted != PermissionStatus.granted) {
return;
}
}
setState(() {
_isGettingLocation = true;
});
locationData = await location.getLocation();
final lat = locationData.latitude;
final lng = locationData.longitude;
if (lat == null || lng == null) return;
_savePlace(lat, lng);
}
void _selectOnMap() async {
final pickedLocation = await Navigator.of(context).push<LatLng>(
MaterialPageRoute(
builder: (ctx) => const MapScreen(),
),
);
if (pickedLocation == null) return;
_savePlace(pickedLocation.latitude, pickedLocation.latitude);
}
@override
Widget build(BuildContext context) {
Widget previewContent = Text(
'No location chosen',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
);
if (_isGettingLocation) {
previewContent = const CircularProgressIndicator();
}
if (_pickedLocation != null) {
previewContent = Image.network(
locationImage,
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
);
}
return Column(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Theme.of(context).colorScheme.primary.withOpacity(0.2),
),
),
height: 170,
width: double.infinity,
alignment: Alignment.center,
child: previewContent,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton.icon(
icon: const Icon(Icons.location_on),
label: const Text('Get Current Location'),
onPressed: _getCurrentLocation,
),
TextButton.icon(
icon: const Icon(Icons.map),
label: const Text('Select on Map'),
onPressed: _selectOnMap,
),
],
),
],
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/widgets/places_list.dart
|
import 'package:favorite_places/models/place.dart';
import 'package:favorite_places/screens/place_detail.dart';
import 'package:flutter/material.dart';
class PlacesList extends StatelessWidget {
const PlacesList({super.key, required this.places});
final List<Place> places;
@override
Widget build(BuildContext context) {
Widget mainContent = Center(
child: Text(
'No places added yet. Start adding some!',
style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
);
if (places.isNotEmpty) {
mainContent = ListView.builder(
itemCount: places.length,
itemBuilder: (ctx, index) {
return ListTile(
leading: CircleAvatar(
radius: 26,
backgroundImage: FileImage(places[index].image),
),
title: Text(
places[index].title,
style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
subtitle: Text(
places[index].location.address,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (ctx) =>
PlaceDetailScreen(place: places[index])));
},
);
});
}
return mainContent;
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/widgets/image_input.dart
|
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
class ImageInput extends StatefulWidget {
const ImageInput({super.key, required this.onPickImage});
final void Function(File image) onPickImage;
@override
State<StatefulWidget> createState() {
return _ImageInputState();
}
}
class _ImageInputState extends State<ImageInput> {
File? _takenImage;
void _takePicture() async {
final imagePicker = ImagePicker();
final pickedImage = await imagePicker.pickImage(
source: ImageSource.camera,
maxWidth: 600,
);
if (pickedImage == null) return;
setState(() {
_takenImage = File(pickedImage.path);
});
widget.onPickImage(_takenImage!);
}
@override
Widget build(BuildContext context) {
Widget content = TextButton(
onPressed: _takePicture,
child: TextButton.icon(
icon: const Icon(Icons.camera),
label: const Text('Take Picture'),
onPressed: _takePicture,
),
);
if (_takenImage != null) {
content = GestureDetector(
onTap: _takePicture,
child: Image.file(
_takenImage!,
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
),
);
}
return Container(
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Theme.of(context).colorScheme.primary.withOpacity(0.2),
),
),
height: 250,
width: double.infinity,
alignment: Alignment.center,
child: content,
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/models/place.dart
|
import 'dart:io';
import 'package:uuid/uuid.dart';
// generate a unique id
const uuid = Uuid();
class PlaceLocation {
const PlaceLocation({
required this.latitude,
required this.longitude,
required this.address,
});
final double latitude;
final double longitude;
final String address;
}
class Place {
Place({
required this.title,
required this.image,
required this.location,
String? id,
}) : id = id ?? uuid.v4();
final String id;
final String title;
final File image;
final PlaceLocation location;
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/screens/new_place.dart
|
import 'dart:io';
import 'package:favorite_places/models/place.dart';
import 'package:favorite_places/widgets/image_input.dart';
import 'package:favorite_places/widgets/location_input.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:favorite_places/providers/user_places.dart';
class NewPlaceScreen extends ConsumerStatefulWidget {
const NewPlaceScreen({super.key});
@override
ConsumerState<NewPlaceScreen> createState() {
return _NewPlaceScreenState();
}
}
class _NewPlaceScreenState extends ConsumerState<NewPlaceScreen> {
final _titleController = TextEditingController();
File? _selectedImage;
PlaceLocation? _selectedLocation;
@override
void dispose() {
_titleController.dispose();
super.dispose();
}
void _savePlace() {
final enteredTitle = _titleController.text;
if (enteredTitle.isEmpty ||
_selectedImage == null ||
_selectedLocation == null) {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: const Text('Invalid Input'),
content: const Text(
'Please make sure a valid title was entered and an image was taken.'),
actions: [
TextButton(
onPressed: () {
Navigator.pop(ctx);
},
child: const Text('OK')),
],
),
);
return;
}
ref
.read(userPlacesProvider.notifier)
.addPlace(enteredTitle, _selectedImage!, _selectedLocation!);
Navigator.of(context).pop();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Add a new place'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
children: [
TextField(
controller: _titleController,
maxLength: 50,
decoration: const InputDecoration(
label: Text('Title'),
),
style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
const SizedBox(
height: 16,
),
ImageInput(
onPickImage: (image) {
_selectedImage = image;
},
),
const SizedBox(
height: 16,
),
LocationInput(
onSelectLocation: (location) {
_selectedLocation = location;
},
),
const SizedBox(
height: 16,
),
ElevatedButton.icon(
onPressed: _savePlace,
icon: const Icon(
Icons.add,
color: Colors.white,
),
label: const Text('Add Place'),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/screens/place_detail.dart
|
import 'package:favorite_places/models/place.dart';
import 'package:favorite_places/screens/map.dart';
import 'package:flutter/material.dart';
class PlaceDetailScreen extends StatelessWidget {
const PlaceDetailScreen({super.key, required this.place});
final Place place;
String get locationImage {
final lat = place.location.latitude;
final lng = place.location.longitude;
return 'https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng=&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7Clabel:A%7C$lat,$lng&key=api_key';
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(place.title),
),
body: Stack(
children: [
Image.file(
place.image,
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Column(
children: [
GestureDetector(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (ctx) => MapScreen(
location: place.location,
isSelecting: false,
)));
},
child: CircleAvatar(
radius: 70,
backgroundImage: NetworkImage(locationImage),
),
),
Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 16,
),
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Colors.transparent, Colors.black54],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
)),
child: Text(
place.location.address,
style: Theme.of(context).textTheme.titleLarge!.copyWith(
color: Theme.of(context).colorScheme.onBackground),
),
),
],
),
),
],
),
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/screens/map.dart
|
import 'package:favorite_places/models/place.dart';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class MapScreen extends StatefulWidget {
const MapScreen({
super.key,
this.location = const PlaceLocation(
latitude: 37.422,
longitude: -122.084,
address: '',
),
this.isSelecting = true,
});
final PlaceLocation location;
final bool isSelecting;
@override
State<StatefulWidget> createState() {
return _MapScreenState();
}
}
class _MapScreenState extends State<MapScreen> {
LatLng? _pickedLocation;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title:
Text(widget.isSelecting ? 'Pick your Location' : 'Your Location'),
actions: [
if (widget.isSelecting)
IconButton(
onPressed: () {
Navigator.of(context).pop(_pickedLocation);
},
icon: const Icon(Icons.save)),
],
),
body: GoogleMap(
onTap: !widget.isSelecting
? null
: (position) {
setState(() {
_pickedLocation = position;
});
},
initialCameraPosition: CameraPosition(
target: LatLng(widget.location.latitude, widget.location.longitude),
zoom: 16,
),
markers: (_pickedLocation == null && widget.isSelecting)
? {}
: {
Marker(
markerId: const MarkerId('m1'),
position: _pickedLocation ??
LatLng(
widget.location.latitude,
widget.location.longitude,
),
),
},
),
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/screens/places.dart
|
import 'package:favorite_places/providers/user_places.dart';
import 'package:favorite_places/screens/new_place.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:favorite_places/widgets/places_list.dart';
class PlacesScreen extends ConsumerStatefulWidget {
const PlacesScreen({super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() {
return _PlacesScreenState();
}
}
class _PlacesScreenState extends ConsumerState<PlacesScreen> {
late Future<void> _placesFuture;
@override
void initState() {
super.initState();
_placesFuture = ref.read(userPlacesProvider.notifier).loadPlaces();
}
@override
Widget build(BuildContext context) {
final userPlaces = ref.watch(userPlacesProvider);
return Scaffold(
appBar: AppBar(
title: const Text('Your Places'),
actions: [
IconButton(
onPressed: () => {
Navigator.of(context).push(
MaterialPageRoute(
builder: (ctx) => const NewPlaceScreen(),
),
)
},
icon: const Icon(Icons.add),
),
],
),
body: Padding(
padding: const EdgeInsets.all(8),
child: FutureBuilder(
future: _placesFuture,
builder: (context, snapshot) =>
snapshot.connectionState == ConnectionState.waiting
? const Center(
child: CircularProgressIndicator(),
)
: PlacesList(
places: userPlaces,
),
)),
);
}
}
| 0
|
mirrored_repositories/Favorite-Places-App/lib
|
mirrored_repositories/Favorite-Places-App/lib/providers/user_places.dart
|
import 'dart:io';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:path_provider/path_provider.dart' as syspaths;
import 'package:path/path.dart' as path;
import 'package:sqflite/sqflite.dart' as sql;
import 'package:sqflite/sqlite_api.dart';
import 'package:favorite_places/models/place.dart';
Future<Database> _getDatabase() async {
final dbPath = await sql.getDatabasesPath();
final db = await sql.openDatabase(
path.join(dbPath, 'places.db'),
onCreate: (db, version) {
return db.execute(
'CREATE TABLE user_places(id TEXT PRIMARY KEY, title TEXT, image TEXT, lat REAL, lng REAL, address TEXT)');
},
version: 1,
);
return db;
}
class UserPlacesNotifier extends StateNotifier<List<Place>> {
UserPlacesNotifier() : super(const []);
Future<void> loadPlaces() async {
final db = await _getDatabase();
final data = await db.query('user_places');
final places = data
.map(
(row) => Place(
id: row['id'] as String,
title: row['title'] as String,
image: File(row['image'] as String),
location: PlaceLocation(
latitude: row['lat'] as double,
longitude: row['lng'] as double,
address: row['address'] as String,
),
),
)
.toList();
state = places;
}
void addPlace(String title, File image, PlaceLocation location) async {
final appDir = await syspaths.getApplicationDocumentsDirectory();
final filename = path.basename(image.path);
final copiedImage = await image.copy('${appDir.path}/$filename');
final newPlace =
Place(title: title, image: copiedImage, location: location);
final db = await _getDatabase();
db.insert('user_places', {
'id': newPlace.id,
'title': newPlace.title,
'image': newPlace.image.path,
'lat': newPlace.location.latitude,
'lng': newPlace.location.longitude,
'address': newPlace.location.address,
});
state = [newPlace, ...state];
}
}
final userPlacesProvider =
StateNotifierProvider<UserPlacesNotifier, List<Place>>(
(ref) => UserPlacesNotifier(),
);
| 0
|
mirrored_repositories/Flutter_E-Note-App
|
mirrored_repositories/Flutter_E-Note-App/lib/splash_screen.dart
|
import 'package:computer_12/main.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart';
class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});
@override
Widget build(BuildContext context) {
return AnimatedSplashScreen(
splash: Lottie.network(
'https://assets4.lottiefiles.com/packages/lf20_f4dmlwbs.json'),
nextScreen: const MyApp(),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App
|
mirrored_repositories/Flutter_E-Note-App/lib/main.dart
|
import 'package:computer_12/mainscreen/main_screen.dart';
import 'package:flutter/material.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:lottie/lottie.dart';
/////initializing
void main() {
WidgetsFlutterBinding.ensureInitialized();
MobileAds.instance.initialize();
runApp(const MyApp());
}
// splash strating screen
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
fontFamily: "Poppins",
useMaterial3: true,
),
debugShowCheckedModeBanner: false, //removes debug banner
themeAnimationCurve: Curves.fastLinearToSlowEaseIn,
home: AnimatedSplashScreen(
splash: Column(
//starting splash screen
children: [
Lottie.asset(
'images/loading.json',
height: 350,
width: 200,
),
],
),
nextScreen: const MainScreen(),
// nextScreen: PageView(),
splashIconSize: 350,
duration: 4500,
splashTransition: SplashTransition.fadeTransition,
backgroundColor: Colors.white,
),
// const HomeView()
);
}
}
// /appbar title and bottom ad call
class MainScreen extends StatelessWidget {
const MainScreen({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: ActionButton(),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/widgets/widgets.dart
|
// ignore_for_file: must_be_immutable, non_constant_identifier_names
import 'package:flutter/material.dart';
//headings
Column chapterHeading() {
return const Column(
children: [
Padding(
padding: EdgeInsets.all(2.0),
child: Text(
'Database',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
),
Text(
'Sources: Buddha Publication Pvt. Ltd.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0,
fontStyle: FontStyle.italic,
),
),
],
);
}
//ending text
class EndingText extends StatelessWidget {
const EndingText({
super.key,
});
@override
Widget build(BuildContext context) {
return const Text(
'***END***',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
);
}
}
//contents of heading
class HeadingDetails extends StatelessWidget {
String contents;
HeadingDetails({
required this.contents,
super.key,
});
@override
Widget build(BuildContext context) {
return SelectableText(
contents,
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions:
// ignore: deprecated_member_use
const ToolbarOptions(copy: true, cut: true, selectAll: true),
style: const TextStyle(
fontSize: 16.0,
),
);
}
}
//topics
class ChapterTopics extends StatelessWidget {
String heading;
ChapterTopics({
required this.heading,
super.key,
});
@override
Widget build(BuildContext context) {
return Text(
heading,
textAlign: TextAlign.start,
style: const TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
);
}
}
class ChapterHeadingMedium extends StatelessWidget {
final String medium_heading;
const ChapterHeadingMedium({
required this.medium_heading,
super.key,
});
@override
Widget build(BuildContext context) {
return Text(
medium_heading,
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: const TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
);
}
}
class TopicsHeadings extends StatelessWidget {
String unit, sources;
TopicsHeadings({
required this.sources,
required this.unit,
super.key,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(2.0),
child: Text(
unit,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
),
Text(
sources,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 14.0,
fontStyle: FontStyle.italic,
),
),
],
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/drawer/drawer.dart
|
// ignore_for_file: avoid_print, deprecated_member_use
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:io';
import 'package:share/share.dart';
import 'package:rating_dialog/rating_dialog.dart';
import 'package:url_launcher/url_launcher.dart';
//slide nav bar drawer
class NavDrawer extends StatefulWidget {
const NavDrawer({super.key});
@override
State<NavDrawer> createState() => _NavDrawerState();
}
class _NavDrawerState extends State<NavDrawer> {
var defaultText = const TextStyle(
color: Colors.black,
fontSize: 14.0,
fontFamily: "Poppins",
);
var linkText = TextStyle(
color: Colors.blue[900],
fontSize: 14.0,
fontFamily: "Poppins",
);
///raating dilogue box. libary
void show() {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 0.2),
child: rateDilogPopUp(),
);
},
);
}
RatingDialog rateDilogPopUp() {
return RatingDialog(
initialRating: 1.0,
title: const Text(
'Feedback',
textHeightBehavior: TextHeightBehavior(applyHeightToFirstAscent: true),
softWrap: true,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
message: const Text(
'Tap a star to set your rating. Add more description here if you want.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14),
),
image: Image.asset(
"images/icon_logo_app.png",
height: 100.0,
width: 100,
),
starSize: 25,
submitButtonText: 'Submit',
commentHint: 'Tell Us Your Comments',
onCancelled: () => print('cancelled'),
onSubmitted: (response) {
print('rating:${response.rating},comment:${response.comment}');
},
);
}
/// main drawer
@override
Widget build(BuildContext context) {
return Drawer(
elevation: 5.0,
child: ListView(
padding: EdgeInsets.zero,
children: [
UserAccountsDrawerHeader(
accountName: const Text(
'Computer Science',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
accountEmail: const Text(
'Grade 12 New Curriculam Course Notes',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
selectionColor: Colors.black,
),
currentAccountPicture: CircleAvatar(
child: ClipOval(
child: Image.asset(
'images/icon_logo_app.png',
width: 95,
height: 95,
),
),
),
decoration: const BoxDecoration(
color: Colors.lightBlue,
image: DecorationImage(
image: NetworkImage(
'https://images.unsplash.com/photo-1635350181304-be3f00f5af76?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1974&q=80',
),
fit: BoxFit.cover,
),
),
),
// icons....
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ListTile(
leading: const Icon(Icons.home, color: Colors.black87),
title: const Text(
'Home',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
onTap: () {
Navigator.of(context).pop();
print('home');
},
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ListTile(
leading: const Icon(Icons.share_rounded, color: Colors.black87),
title: const Text(
'Share',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
onTap: () {
Share.share(
'https://play.google.com/store/apps/details?id=com.instructivetech.testapp');
print('share');
},
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ListTile(
leading: const Icon(Icons.star_outlined, color: Colors.black87),
title: const Text(
'Rating',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
onTap: () {
show();
print('Rate');
},
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ListTile(
leading:
const Icon(Icons.lock_outline_rounded, color: Colors.black87),
title: const Text(
'Privacy Polices',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
onTap: () {
privacyDilogBox(context);
},
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ListTile(
leading: const Icon(
Icons.exit_to_app_rounded,
color: Colors.black87,
),
title: const Text(
'Exit',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
onTap: () {
if (Platform.isAndroid) {
SystemNavigator.pop();
print('exit');
}
},
),
),
],
),
);
}
Future<dynamic> privacyDilogBox(BuildContext context) {
return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text(
"Privacy Policies",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
content: SingleChildScrollView(
child: RichText(
textAlign: TextAlign.justify,
text: TextSpan(
style: defaultText,
children: [
const TextSpan(
text:
"We prioritize your privacy. Notebook does not collect any personal data. Any information gathered is strictly limited to enhancing app functionality, such as device information and usage statistics. We do not store or share personally identifiable information with third parties. Our commitment to your privacy means we refrain from requesting or storing unnecessary personal details. While Notebook may include links to external sites, we do not assume responsibility for their privacy practices. Your data is safeguarded using industry-standard security measures. For any questions or concerns regarding our privacy policies. ",
style: TextStyle(
fontSize: 12,
),
),
TextSpan(
style: linkText,
text: "GITHUB",
recognizer: TapGestureRecognizer()
..onTap = () async {
var url =
"https://github.com/Nishan-Pradhan06/Flutter_E-Note-App";
if (await canLaunch(url)) {
await launch(url);
} else {
throw "cannot thorw url";
}
},
),
],
),
),
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Close'),
),
],
);
},
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/mainscreen/main_screen.dart
|
import 'package:flutter/material.dart';
import 'package:computer_12/drawer/drawer.dart';
import 'package:computer_12/topics/topics.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
class ActionButton extends StatefulWidget {
const ActionButton({super.key});
@override
State<ActionButton> createState() => _ActionButtonState();
}
class _ActionButtonState extends State<ActionButton> {
ValueNotifier<bool> isDialOpen = ValueNotifier(false);
late BannerAd _bannerAd;
bool _isAdLoaded = false;
//////////advertisment code
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 40.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: const Text(
'Computer Science',
style: TextStyle(
color: Colors.white,
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
),
body: const SizedBox(
child: TopicsList(),
),
backgroundColor: const Color.fromARGB(130, 173, 223, 241),
///banner advertisment
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
drawer: const NavDrawer(),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit7.dart
|
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:url_launcher/url_launcher.dart';
class TechNology extends StatefulWidget {
const TechNology({super.key});
@override
State<TechNology> createState() => _TechNologyState();
}
class _TechNologyState extends State<TechNology> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
var defaultText = const TextStyle(
color: Colors.black,
fontSize: 14.0,
fontStyle: FontStyle.italic,
fontFamily: "Ubuntu",
);
var linkText = const TextStyle(
color: Colors.blue,
fontSize: 14.0,
fontStyle: FontStyle.italic,
fontFamily: "Ubuntu",
);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 25.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: const Text('Unit 7',
style: TextStyle(fontSize: 30, color: Colors.white)),
toolbarHeight: 60.0,
),
body: PageView(
children: [
GestureDetector(
child: CupertinoScrollbar(
///scrollbar
thickness: 10.0,
thumbVisibility: true,
radius: const Radius.circular(10.0),
thicknessWhileDragging: 10.0, //scro//bar
child: InteractiveViewer(
///starting contain
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const Padding(
padding: EdgeInsets.all(2.0),
child: Text(
'Recent Trend in Technology',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
),
RichText(
textAlign: TextAlign.center,
text: TextSpan(
children: [
TextSpan(
style: defaultText,
text: "Sources: ",
),
TextSpan(
style: linkText,
text: "readersnepal.com",
recognizer: TapGestureRecognizer()
..onTap = () async {
var url =
"https://readersnepal.com/e-notes/neb-new-course-class-12/computer-science-3";
// ignore: deprecated_member_use
if (await canLaunch(url)) {
// ignore: deprecated_member_use
await launch(url);
} else {
throw "cannot throw Url";
}
},
),
],
),
),
const Text(
"Sources: Buddha Publication Pvt. Ltd.",
textAlign: TextAlign.center,
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: 14.0,
// fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 8.0,
),
const Text(
'Artificial Intelligence',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Artificial intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think like humans and mimic their actions. It is a concept of giving human-like intelligence to the machines. Though the computers do their work faster and better than the human beings, the intelligence of them is zero because they just follow the set of instructions given by the user. In case of wrong instruction, they do wrong processing. It is because they do not have intelligence of their own. So, the scientists are in research of giving them artificial intelligence, so that they can understand the natural languages of the human beings and interact. They can express their feelings and many more.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types of Artificial Intelligence',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Artificial Narrow Intelligence (ANI)\n2. Artificial General Intelligence (AGI)\n3. Artificial Super Intelligence (ASI)",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Features of Artificial Intelligence',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Time saving\n2. Can be read any time and any where\n3. Course moves faster than traditional method\n4. Uniformity of content\n5. Data is hidden and cannot be accessed by external functions.\n6. Interactive online session",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Uses of Artificial Intelligence',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Game Playing\n2. Expert System\n3. Pattern Recognition\n4. Natural Language Processing (NLP)\n5. Automated Operation\n6. Robotics",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Robotics',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Robotics ia the branch of techonology that deals with the design, construction, opreation, structural disposition, manufacture and application of robots. It is the term used for the designing, constructing and using robots in various purposes. The term ‘robot’ was first used by Karel Capek in his play Rossum’s Universal Robots, published in 1920. Scientists are trying to give the human-like intelligence to the robots, so that they understand the natural languages and they can be able to interact with the humans to assist them. Transportation, exploration, surgery, bomb diffusion, etc. are some popular application of robots. They are especially used in the areas, which are full of risk.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Essential characteristics of robot',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Sensing\n2. Movement\n3. Energy\n4. Intelligence",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Virtual Reality',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Virtual reality (VR) is a computer simulated or artificial environment that is created with software and presented to the user in such a way that the user believes and accepts it as a real environment. On a computer, virtual reality is primarily experienced through two of the five senses: sight and sound. \n\nThe simplest form of virtual reality is a 3-D image that can be explored interactively at a personal computer, usually by manipulating keys or the mouse so that the content of the image moves in some direction or zooms in or out. ",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Advantages of Virtual Reality',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. More than Real\n2. Safe Practice/Simulation\n3. Detailed\n4. Handy\n5. Increased Learning Possibilities",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Disadvantages of Virtual Reality',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Cost\n2. Speed\n3. Productivity\n4. Performance\n5. Reliability\n6. Security",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Cloud Computing',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The cloud computing is the delivery of computing services such as database, stroage, networking, software etc. over the internet to offer faster innovation, flexible resources. It helps for lowering the costs and inceases the efficiency of business. Cloud computing is more efficient way of delivering computing resources. With cloud computing, software and services environments are subscription-based - users pay a monthly fee instead of buying licenses. Multiple people can access a shared program or file and collaborate in real time from different locations. Organizations of every type, size and industry are using the cloud for many purposes such as data backup, email, disaster recovery, software development, testing, web applications and more.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true,
cut: true,
selectAll: true,
),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types of Cloud Computing',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Public Cloud\n2. Private Cloud\n3. Hybrid Cloud\n4. Multi-Cloud ",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types of Cloud Services',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Infrastructure as a service (IaaS)\n2. Platform as a service (PaaS)\n3. Software as a service (SaaS)",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Benefits of Cloud Services',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Cost\n2. Speed\n3. Productivity\n4. Performance\n5.Reliability\n6.Security",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Big Data',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Big Data is a collection of huge volume of data which is growing exponentitally with time. The big data are huge and complex data which needs specialized tools to process and extract. It is difficult to porocess and store by traditional approach. It needs advanced models and tools and to process, store and extract. ",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types of BIg Data',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Structured data\n2. Unstructured data\n3. Semi-Structured data",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Characteristics of Big Data',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Volume\n2. Variety\n3. Velocity\n4. Variability",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Advantage of Big Data',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Better decision-making\n2. Increased productivity\n3. Reduce costs\n4. Improved customer service\n5. Fraud detection\n6. Increased agility\n7. Greater innovation\n8. Faster speed to market",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Disadvantage of Big Data',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Need for talent\n2. Need for cultural change\n3. Cybersecurity risks\n4. Rapid change\n5.Hardware needs\n6. Costs\n7. Difficulty integrating legacy systems ",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'E-learning',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"E-learning is the process of learning through the electronic media like computers. The concept of Distant Learning has become possible through the e-learning. One can get degree of a university through the e-learning. The CAL (Computer Assisted/Aided Learning) is an example of E-learning. Internet, Intranet, Extranet, Virtual Class room and Multimedia CD/DVD ROM are the tools used in E-learning.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Advantage of E-Learning',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Time saving\n2. Can be read any time and any where\n3. Course moves faster than traditional method\n4. Uniformity of content\n5. Data is hidden and cannot be accessed by external functions.\n6. Interactive online session",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'E-commerce',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The commerce through the use of electronic media is called E-commerce. It is the most popular and highly used advantage of IT. Replacing the traditional method of account controlling, quality and quantity controlling, money transaction, official and industrial management, etc. by the computers and electronic machines are some popular concepts of E-commerce. ",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types of E-commerce',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Business-to-Business (B2B)\n2. Business-to-Customer (B2C)\n3. Consumer to consumer (C2C)\n4. Consumer to Business (C2B) ",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'E-Business',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The process of performing business activities through the electronic media, especially Internet is called E-Business. It includes selling, buying and servicing customers and collaborating with the business partners, too. It uses web-based technology for the advertisements and for the improved business performance. Some examples of this system are ebay, amazon, Alibaba etc",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'E-Governance',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The process of governing through the use of Electronic media is called E-Governance. The traditional governing system cannot reach to the remote or rural area and it cannot address the actual problem of them. It is centered in the urban area. So, the E-Governance has become a popular concept of governing. It uses electronic media like Internet, Intranet, Wireless Phone, E-voting, E-commerce, E-health service and E-education, etc to address the problem of the people. It increases the speed of working of Government.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const SelectableText(
"In other word, The way of performing governmental activities through internet. For instant, every citizen has to perform their daily governmental activities such as birth registration, tax payment, utilities bill payment etc. If these governmental activities are done through electronic means and media then, it is known as e-government. The major objective of e-government is to increase accountability, transparency, efficiency and which helps to reduce corruption.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Types of E-Governance',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Government to Citizens (G2C)\n2. Government to Employees (G2E)\n3. Government to Government (G2G)\n4. Government to Business (G2B)",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Challenges of E-government:',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. IT literacy\n2. Lack of co-ordination\n3. Training\n4. IT Policy",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Importance of E-government:',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"a. Promote awareness and dramatically improves the efficiency of the civil services.\nb. It will encourage public participation.\nc. It will create healthy business environment.\nd. It increases accountability, transparency, efficiency and which helps to reduce corruption.\ne. It allows to share knowledge and information betwee organizatio easily.",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'E-Medicine',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Electronic medicine is a service of E-Government, which provides E-health services to the people. The use of computers for diagnosis of diseases, operations and research of medicine are the examples of E-Medicine. The way of performing medical activities through electronic means and media are e-medicine. Now a days, there are significant roles of modern tools and technologies in the field of medicine. For eg, Technologies such as X-rays, CT scan etc are used to diagnosis several critical diseases and illness. There are several websites which are particularly targeted toward medicine. These websites help user to find out the required information about their queries. One can check the health condition using electronic means and media.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Advantage of E-Medicine ',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Distance medical facilities can be provided to remote area.\n2. Drones can be used to supply medical equipment in needy area with in less time.\n3. Remote counseling is possible through e-medicine.\n4. Different high-tech tools and devices are used to diagnose several critical illnesses.",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Mobile Computing',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Electronic medicine is a service of E-Government, which provides E-health services to the people. The use of computers for diagnosis of diseases, operations and research of medicine are the examples of E-Medicine. The way of performing medical activities through electronic means and media are e-medicine. Now a days, there are significant roles of modern tools and technologies in the field of medicine. For eg, Technologies such as X-rays, CT scan etc are used to diagnosis several critical diseases and illness. There are several websites which are particularly targeted toward medicine. These websites help user to find out the required information about their queries. One can check the health condition using electronic means and media.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Advantage of Mobile Computing',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Protable.\n2. Social interactivity\n3. Context sensitivity\n4. Connectivity ability\n5. Commonly used\n6. Quick service\n7. Easy and quick enhancement",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Disadvantage of Mobile Computing',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Insufficient bandwidth\n2. Security standards\n3. Power consumption\n4. Human interface with device",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Concept of IOT',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The internet of things (IoT) is a system of interrelated computing devices, mechanical and digital machines, objects, animals or people that are provided with unique identifiers and the ability to transfer data over a network without requiring human-to-human-to computer interation.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontSize: 17.0,
// fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Advantage of IoT',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Ability to access information from anywhere at any time on any device\n2. Improve communication between connected devices and users\n3. Transferring data packets over a connected network saving time and money\n4.Automating tasks helping to improve the quality of a business's services",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Disadvantage of IoT',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1.As the number of connected devices increases and more information is shared between devices, high risk with the hackers.\n2.Massive numbers of data to be processed.\n3.The structure is complex to communicate among the devices because of massive number of devices.",
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'***END***',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
),
),
),
],
),
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit2.dart
|
// import 'package:computer_12/Contains/unit3.dart';
import 'package:computer_12/widgets/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import '../strings/string_unit2.dart';
class NetWork extends StatefulWidget {
const NetWork({super.key});
@override
State<NetWork> createState() => _NetWorkState();
}
class _NetWorkState extends State<NetWork> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
//defining the textstyle
var headlineText = const TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
);
var pragraphStyleText = const TextStyle(
color: Colors.black,
fontSize: 17.0,
);
var pointStyleText = const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 17.0,
);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
elevation: 25.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: Text(
titleText,
style: const TextStyle(fontSize: 30, color: Colors.white),
),
),
body: PageView(
children: [
GestureDetector(
child: CupertinoScrollbar(
thickness: 10.0,
thumbVisibility: true,
thicknessWhileDragging: 10.0,
child: InteractiveViewer(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const SizedBox(
height: 20,
),
Text(
topics,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
Text(
sources,
textAlign: TextAlign.center,
style: const TextStyle(
fontStyle: FontStyle.italic,
fontSize: 14.0,
),
),
const SizedBox(
height: 8.0,
),
//headline topics
Text(
headline1,
textAlign: TextAlign.start,
style: headlineText,
),
const SizedBox(
height: 6.0,
),
SelectableText(
pragraph1,
textAlign: TextAlign.justify,
style: pragraphStyleText,
),
const SizedBox(
height: 20.0,
),
Text(
headline2,
textAlign: TextAlign.start,
style: headlineText,
),
const SizedBox(
height: 6.0,
),
SelectableText(
pragraph2,
style: pragraphStyleText,
),
const SizedBox(
height: 20.0,
),
Text(
point1,
style: pointStyleText,
),
SelectableText(
point1Explanations,
textAlign: TextAlign.justify,
style: pragraphStyleText,
),
Image.asset("images/unit_2/simplex.jpg"),
Text(
exmaple1,
textAlign: TextAlign.center,
style: pragraphStyleText,
),
const SizedBox(
height: 20.0,
),
Text(
point2,
style: headlineText,
),
SelectableText(
point2Explanations,
textAlign: TextAlign.justify,
style: pragraphStyleText,
),
Image.asset("images/unit_2/half-duplex.jpg"),
const Text(
'',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
),
Text(
example2,
textAlign: TextAlign.center,
style: pragraphStyleText,
),
const SizedBox(
height: 20.0,
),
Text(
point3,
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: headlineText,
),
SelectableText(
point3Explanations,
textAlign: TextAlign.justify,
style: pragraphStyleText,
),
Image.asset("images/unit_2/full-duplex.jpg"),
Text(
example3,
textAlign: TextAlign.center,
style: pragraphStyleText,
),
const SizedBox(
height: 20.0,
),
Text(
headline3,
style: headlineText,
),
const SizedBox(
height: 6.0,
),
SelectableText(
pragraph3,
textAlign: TextAlign.justify,
style: pragraphStyleText,
),
const SizedBox(
height: 20.0,
),
Text(
h4,
textAlign: TextAlign.left,
style: headlineText,
),
const SizedBox(
height: 6.0,
),
Text(
p4,
textAlign: TextAlign.left,
style: pointStyleText,
),
const SizedBox(
height: 6.0,
),
SelectableText(
p5,
textAlign: TextAlign.justify,
style: pragraphStyleText,
),
const SizedBox(
height: 6.0,
),
Text(
'b. Faster and cheaper communication',
style: pointStyleText,
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Communication in modern days has become very faster and cheaper to send information letters, attach files, perform voice chat and video conference with almost free cost with the help of network. ",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'c. Centralized Control',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"All network resources such as computer printers, file, database etc can be managed and controlled by a cetnral connecting computer also known as the server. So, any rules, privilages, security measures that are necessary in the network can be automatically implemented to the computers and other device from system.",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'd. Backup and Recover',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Server is used to keep data as backup. It maintains backup of individuals computer information. So, if only data files are lost in any computer, it is possible to restore them form the server.",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'e. Remote and Mobile Access',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Demerits of Computer Network',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'a. Expensive',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"In order to install computer network, we require some extra cost purchase networking devices such as hubs, switch, router etc. Networking equipemtns and networking software are expensive too.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'b. Security Problems',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"Network security is the most challenging job for network administrator in order to project network resources form unauthorized users and physical destructions.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'c. Needs Techincal Person',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It is very difficult to install and opreate good compuer network. In order to manage computer network, the orgainzation needs network, the organization needs network specialist. So, it is very expensive for an organization to hire network specialist. ",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Communications System',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Communication system is a system designed to send information from a scource generating that information to one (Point ot point communication) or more (boardcasting) receivers of that information. Example of communication are the telephone, line, telegraphy, radio etc.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Basic Element of Data communication System',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'a. Message:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The message is data or information to be communicated and it is in the form of text, number, picture, audio and video.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'b.Sender',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"The sender device sends the message to the receiver and it can be computer, workstation or any networking devices.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'c.Receiver',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"The receiver device receive the message form the medium and it can be computer workstation, or any networking devices.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'd. Transmission Medium',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The transmission medium is physical connectin in which a message can travel form sender to receiver and vice-versa.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'e. Protocols',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"A protocols is a set of common rules that manages the data communication, iwthiut protocols two devices can be connected but not be communicated. It is represents an agreement among the different communication devices in a network.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types Of Computer Network',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"There are three types of Computer Network: -\ni) LAN\nii) WAN\niii) MAN",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'a. Local Area Network(LAN)',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"A Local Area Network(LAN) is privately owned small sized network. It spans only in small geographical area such as within a room, office, buildings or up to few km(2km to 3km). It connects the network resources, such as computers, faxes, printers, and various networking devices.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Features of Local Area Network (LAN)',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) LAN is small privately owned network and covers only few kilometers(up to 3 km).\nii) It has higher speed data transfer rate maximum up to 1000Mbps i.e. Gbps.\niii) It is highly secured network and it has least eror rate than others.\niv) It is least expensive type of network become it requires least expensive devices such as NIC, HUB, Bridge etc.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'b.Metropolitan Area Network(MAN)',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"A Metropolitan Area Network (MAN) can be either public or privately owned network. Its size is bigger than LAN and smalller than WAN. It spans within one metropolitan city or large geographical area. It can connect large number of computers and hetrogeneous multiple LANs within a city maximum up to 100km.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Features of Metropolitan Area Network (MAN)',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) MAN is complex and hetrogeneous type of network and it may be either public or privately own.\nii) The size of MAN is bigger than LAN and it covers maximum up to 100km.\niii) It uses different types of media such as coaxial cable, optical fiber, microwave etc.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'c.Wide Area Network(WAN)',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"A Wide Area network (WAN) is basically public type hetrogeneous network. It is the largest sized network and connects millions of computer, thousand of LANs, hundreds of MANs around the countries, continents and even the whole world.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Features of Wide Area Network (WAN)',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) WAN is basically public netwoek that cover millions of kilometers around the world.\nii) It has low speed data transfer 64Kbps to 10 Mbps or more.\niii) It is less secured network and it has highest error rate.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Computer Network',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Network Topologies refers the physical structure of a network that deals with how the computers are interconnected by using cabling system. It shows the geometrical representation of all the links and linking devices, also called nodes. The main objective of the network topology is to find out the most economical and efficient way of transmission channel. The most common LAN topologies are bus, star, ring, tree, mesh and hybrid.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Bus Topology',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 19.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Bus topology is a network setup where each computer and network device is connected to a single cable or backbone. Computers are connected to a single continuous cable that is called bus. A bus must be terminated on both sides to prevent signal bounce and computers are connected to the bus with the help of drop line and T-connector.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Advantages of Bus Topology',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i)It is simple and easy to setup and extend the network.\nii)It is inexpensive topology because it requires less amount of cable and no additional network devies.\niii) If any computer in the network downs, then it does not affect other computers.\niv) It is more flexible because we can easily connect and disconnect any number of computer in the bus.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Disadvantages',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i)Data traffic is very high in bus so there may be chances of data collision.\nii) The length of bus should be small otherwise the performance of the network goes down.\niii) If there is problem in bus then the entire network goes down.\niv) It is very difficult to find out the fault in the bus.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Star Topology',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 19.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
'Star topology is a network topology in which each network component is physically connected to a central node such as a router, hub or switch.Many home networks use the star topology. A star network features a central connection point called a "hub node" that may be a network hub, switch or router. Devices typically connect to the hub with Unshielded Twisted Pair (UTP) Ethernet.',
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Advantages',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) It is simple and easy to setup re-configuration.\nii) It is flexible to connect new computer and emove existing computer in the network.\niii) It is very easy to find out fault because of the use of hub or switch.\niv) If any computer in the network goes down, then other computer can continue their functions.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Disadvantages',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i)It requires very large amount of cables.\nii) It is expensive topology because of cables and networking devie hub or switch.\niii) If there is problem in central device hub or switch then the entire network will be down.\niv) The data traffic is high in central device hub so there may be chances of data collision.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Ring Topology',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 19.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
'A ring topology is a network configuration where device connections create a circular data path. Each networked device is connected to two others, like points on a circle. Together, devices in a ring topology are referred to as a ring network. In a ring network, every device has exactly two neighbors for communication purposes. All messages travel through a ring in the same direction (either "clockwise" or "counterclockwise"). A failure in any cable or device breaks the loop and can take down the entire network.',
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Advantages',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) It is simple and inexpensive topology.\nii) There is less chance of data collision because of unidirectional data transmission.\niii) There is no server so each computer has equal access facilities to the resources..\niv) Its performance is better than bus topology for small size network.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Disadvantages',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) It is not flexible topology so it is difficult for adding and removing new nodes.\nii) It is not suitable for large size network (not more than 10 nodes).\niii) If there is problem in any computer or connection then the entire network goes down.\niv) It is very difficult to find out the errors in the network.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Network Architecture',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The network architecture refers to various services provided by the network such as how data is transmitted from one computer to another, how services can be implemented and how they are interconnected using various protoclos.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Types of Network Architecture',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) Client Server Network Architecture\nii) Peer to Peer Network Architectur",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Client Server Network Architecture ',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"In this architecture, there are two types of computer, one is server and the other is client. Server is the main computer in a network that controls, manages and provides varrious services to the clients such as print sercer, file server, database server, mail server and web browser.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Advantages of CSNA',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) It is easier for centralized administration, controlling and monitoring and the entire network from server.\nii) It is provides centralized backup and recovery features so it is considered as more secure and reliable architecture\niii) It is easier for managing the large size network (More than 10 Computers).",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Peer to Peer Network Architecture',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"In this architecture, each workstation can have equal capabilities and resposibilities in a network. There is no server, each workstation acts like server as well as client. Message is transmtted from one workstation to another workstation in one to one basis by making peer.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Advantages Of Peer to Peer Network Architecture',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) It has simple architecture and easy to install.\nii) It is suitable for small sized network which has maxmium to 10 nodes.\niii) Each node has equal privileges to access the resources of its own and other nodes connected to the network.",
textAlign: TextAlign.justify,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Transmission Media',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Transmission Media refers to the physical connection through which data are transmitted between sender and receiver devices.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'Types of Transmission Media',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"i) Bounded Media\nii) Unbounded Media",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'i) Bounded Media',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
'Bounded Transmission Media use "Cabling" system that guides the data signals along a specfic path.\nThe most common guided path media are: -\n\ni) Twisted Pair Cable\nii) Coaxial Cable\niii) Optical Fiber Cable ',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'ii) Unbounded Media',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Transmission Media which do not use any physical connection betwwen two community devices are called unbounded media or unguided media or wireless media. Such type of media use radio waves, Mircrowaves and satellite.\nIt is classified into three media:-\n\ni) Radio wave\nii) MicroWave\niii) Satellite",
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(fontSize: 17.0),
),
const SizedBox(
height: 20.0,
),
const Text(
'Difference Between internet and intrane',
textAlign: TextAlign.start,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 21.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
Image.asset("images/unit_2/internet_intranet.jpg"),
const SizedBox(
height: 20.0,
),
const Text(
'OSI Reference Model',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"An OSI reference model of network is ISO certified model that entirely describes how information is transmitted from an application of one computer to another application of other computer. International Standard Organization (ISO) is a multinatinal body committed for the worldwide standardization of products, services and businesses.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'1. Physical Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It is responsible for transmmiting raw bits from one node to another over communication channel. So it defines the mechanical, eletrical, functional and procedural standards for the physical transmission of data over the communication medium.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'2. Data Link Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It is responsible for moving frames from one node to another node. It provides different facilities such as physical addressing, data framing, flow control, error control, access control etc. It is also helps to detect errors that may occur in the physical layer.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const Text(
'3. Network Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It is responsible for delivery of packets from source host to destination host. It provides different facilities such as logical addressing, routing, etc. It is the agent for establishing connection between heterogeneous networking systems. It also includes operational control procedures for inter-network communication as well as routing information through multiple networks.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'4. Trasnport Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It is responsible for delivery of message from one applicaton to another application. It provides different facilities such as services point addressing, segmentation, reassembly, connection control, flow control, error control, etc. It divides the message into blocks and transport them.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const Text(
'5. Session Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"The session layer is responsible for dilog control and synchronization between two devices. This layer provides the mechanism for organizing and structuring interaction between two applications or devices.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'6. Presentation Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It is concerned with the syntax and semantics of the information transmitted. It is also responsible for representation of the data to the end user or application. It includes data connection and code translation(e.g. ASCII to EBCDIC)",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const Text(
'7. Application Layer',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"It allows aplication to access network services. It is completely user-oriented layer. Some of its functions are file transfer, accessing remote file, database, e-mail etc.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Internet Protocol Addressing:',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The term protocol refers to the set of rules and procedures that govern the transmission of message over a physical networking medium. Protocols has three major components: syntax, semantics and timing. SSyntax defines grammatical rules, semantic defines logical meaning and the timing defines the delivery time for the synchronization. Computer can communicate with each ihter only if they use a same protocol. Some standard protocols are TCP/IP, HTTP, FTP, STMP, POP, CSMA/CD, TOKEN RING, ETHERNET etc.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'Types of Protocols: ',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"a) Transmission control protocols(TCP)\nb) Internet Protocol (IP)\nc) Simple Mail Transfer Protocol(SMTP)\nd) Post offive Protocol(POP)\ne) File Transfer Protocol(FTP)\nf) Hyper Text Transfer Protocol(HTTP)\ng)Hyper Text Transfer Protocol secure (HTTPs\nh) TELNET",
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const Text(
'IP address:',
textAlign: TextAlign.left,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The term protocol refers to the set of rules and procedures that govern the transmission of message over a physical networking medium. Protocols has three major components: syntax, semantics and timing. SSyntax defines grammatical rules, semantic defines logical meaning and the timing defines the delivery time for the synchronization. Computer can communicate with each ihter only if they use a same protocol. Some standard protocols are TCP/IP, HTTP, FTP, STMP, POP, CSMA/CD, TOKEN RING, ETHERNET etc.",
textAlign: TextAlign.justify,
// textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
const EndingText(),
],
),
),
),
),
),
),
],
),
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit3.dart
|
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import '../widgets/widgets.dart';
class WebDevelopment extends StatefulWidget {
const WebDevelopment({super.key});
@override
State<WebDevelopment> createState() => _WebDevelopmentState();
}
class _WebDevelopmentState extends State<WebDevelopment> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xff618989),
elevation: 25.0,
centerTitle: true,
title: const Text('Unit 3',
style: TextStyle(fontSize: 30, color: Colors.white)),
),
body: PageView(
children: [
GestureDetector(
child: CupertinoScrollbar(
thickness: 10.0,
thumbVisibility: true,
thicknessWhileDragging: 10.0,
child: InteractiveViewer(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
TopicsHeadings(
unit: 'Web Technology',
sources: 'Sources: Buddha Publication Pvt. Ltd.',
),
const SizedBox(
height: 16.0,
),
ChapterTopics(
heading:
'Web technology with Server side and client side programming',
),
HeadingDetails(
contents:
'Web technology is the tools and techniques which enables two or more computing devices to communicate over a network i.e. Internet. Web Technology consist of two words, the web refers to the World Wide Web generally known as World Wide Web. WWW is the cyber space containing webpages, documents, and any other resources which are identified and located with the help of their URLs. Technology refers to the tools and techniques that makes these resources available on the Web such as, web browsers to view content of web, Programming languages and frameworks for the development of websites, Database to store data at back end, protocols for communicating on the web, multimedia elements etc.\n\nWeb development is the process of designing and developing website which are hosted through internet or intranet. The process of developing web can range from developing static page to a complex such as web based application social media sites, E-commerce. Web development includes web design, web content development, client side scripting, server side scripting, web engineering etc. Since, web development consists of several inter-related task which can be accomplish by different types of developer who focuses on different aspect of web creation. ',
),
Image.network(
"https://readersnepal.com/storage/post-images//XwZXfpgDXN4K1Wt7ro3HCQhDRAtS4vUyo9qc2gQP.jpg"),
const SizedBox(
height: 8,
),
ChapterTopics(
heading: 'Server side and client side programming',
),
const ChapterHeadingMedium(
medium_heading:
'Client-Side Scripting programming'),
HeadingDetails(
contents:
'Client-side scripting is performed to generate a code that can run on the client side i.e (front end) browser without needing the server-side (back end) processing. Basically, client-side scripts are placed inside an HTML document. The client-side scripting can be used to layout the content of the web. For example, when a user makes a request through web browser for a webpage to the server, it just sent the HTML and CSS as plain text, and the browser interprets and renders the content of web in the client end (user). Client-side scripting is designed to run as a scripting language which can be executed by web browser. Front end developer is someone who design and develop client side of a website. Generally. he or she works in user interface (UI) of a website. Front end developer must be at least fluent in three different languages i.e. HTML, CSS, JavaScript whereas, there are several other libraries which can be used for front end development.',
),
const ChapterHeadingMedium(
medium_heading:
'Server-Side Scripting programming'),
HeadingDetails(
contents:
'Server-side scripting also known as back-end runs on the server where the application is hosted. Server-side is used to serve content depending upon the user request. Back end helps to create dynamic web based application that allows user to interact and communicate with the application. Back end language also helps to connect front end with data base. So that, User can store and retrieve data as per the requirement. Back-end developer is responsible for server-side programming. Some of the popular server-side (back-end) scripting language are ASP, JavaScript (using SSJS (Server-side JavaScript e.g. node.js), Perl, PHP, Ruby, Python etc.\n\nClient-side scripting and server-side scripting both works along side. The client-side scripting emphasizes making the interface of the web application or website (UI) more appealing and functional. Whereas, server-side scripting emphasizes on data accessing methods, error handling and fast processing etc..\n\nNote: Full-stack developer understand both Front end and back end development process. They can accomplish entire project. Full stack developer must have expertise in client site and server site Scripting language. Moreover, he/she has a great knowledge of integrating database with the application.',
),
const SizedBox(
height: 8.0,
),
ChapterTopics(
heading: 'How to add JavaScript in web pages?',
),
HeadingDetails(
contents:
'JavaScript is a client-side scripting language used for web development along with other front-end development tool such as HTML and CSS. JavaScript helps to give dynamic behavior to our web pages such as adding animation, drop down menus, client-side validation etc. More over JS can be used for mobile apps development and game development. JavaScript is known as scripting language because it does not need to be compiled before execution, it executes in run-time environment through web browser. Several libraries of JavaScript such as React JS, Vue JS, Angular JS etc can be found and used to make more interactive, intuitive and advance web pages. JS is not only used for front-end rather it can be used in server side also. Node JS is an example of server-side JavaScript generally known as SSJS.',
),
Image.network(
"https://readersnepal.com/storage/post-images//Es7aWxYFUc5GFtVWMq2KV4GFl3OfCCwkjZk4vvLg.jpg",
),
ChapterTopics(heading: 'Feature of JavaScript'),
HeadingDetails(
contents:
'- It is light weighted and interpreted language which execute in run-time environment directly through web browser.\n- It is supported by all the web browser since 97% of all web sites use JS.\n - It is also a structural programming language since it support control structure such as branching and looping. \n - It is prototype based programming language which means we can create object without creating classes, so it is also a Object Oriented programming3. \n -JavaScript is a case-sensitive language, small and upper case differs. \n -Every operating system such as Windows, MacOS supports JS.',
),
ChapterTopics(heading: 'Uses of JavaScript'),
HeadingDetails(
contents:
'- JS is used for client-side validation.\n- JS can be used to make dynamic drop-down menus.\n- JS can be used to display date, time and even clock.\n- JS can be used to generate pop-up windows, alert message, dialog box etc\n- JS can also be used for Server application.\n- JS can be used for cross platform mobile apps development.\n- JS can be used for game development.',
),
ChapterTopics(
heading: 'Adding JavaScript to HTML document'),
HeadingDetails(
contents:
'As we know, JS is often used as client-side scripting language along with HTML and CSS. Like we add CSS to our HTML document, similarly we can add our JavaScript code to HTML document in three several ways. The several ways of adding JavaScript to HTML document are:'),
const ChapterHeadingMedium(
medium_heading: '1 .Inline JavaScript code'),
HeadingDetails(
contents:
'This is the method of adding JS code directly inside the HTML tag. We don’t have to create separate JS file or even we don’t have to place JS code with in script tag. Simple events like onclick, mouseover, keypress can easily be added through this method. But, its very much inconvenient to add large JS code inline. JavaScript code can be added in HTML document inline as follows:',
),
Image.asset("images/unit_3/e1.png"),
HeadingDetails(
contents:
'Here, we have added alert message through onclick event. When user press the Click me button then alert message will be shown in the web browser.'),
const SizedBox(
height: 8.0,
),
const ChapterHeadingMedium(
medium_heading:
'2. Internal (Embedding) JavaScript code'),
HeadingDetails(
contents:
'This is the method of adding JS code within the HTML document. JS code is added internally with in the script tag inside body of the HTML document. JavaScript code can be embedded within HTML document as follows:'),
Image.asset("images/unit_3/e2.png"),
HeadingDetails(
contents:
'Here, we have created a JS function named disp( ), this function is called when user press the Click me button. Once button is pressed alert message is displayed which is defined inside function within Script tag.'),
const SizedBox(
height: 8.0,
),
const ChapterHeadingMedium(
medium_heading: '3. External JavaScript file'),
HeadingDetails(
contents:
'This is the most popular methods of adding JS in our web pages. To add external JavaScript we have to create separate JS file which is linked with our HTML document as:'),
Image.asset("images/unit_3/e3.png"),
HeadingDetails(
contents:
'Where, name.js is the JavaScript file that we create to write all our JS code. It should be in same location with our HTML document. It is most convenient way of adding JS in our web page as JS code don’t get messed with other HTML and CSS code. JavaScript code can be externally added with HTML document as follows:\n\nCreate a HTML document with any name'),
Image.asset("images/unit_3/e4.png"),
HeadingDetails(
contents:
'Also create a JS file with .js extension and add following code'),
Image.asset("images/unit_3/e5.png"),
HeadingDetails(
contents:
'Here, we have created separate HTML and JS file in same location. Since, we have linked our JS file with our HTML document, every code which is written in JS file will be implemented on HTML document.',
),
const SizedBox(
height: 16.0,
),
ChapterTopics(
heading:
'Local and global variable in JavaScript'),
HeadingDetails(
contents:
'Variables are the identifiers which holds value during our program execution. These values may change throughout the program. Depending upon the nature of data variable can hold several type of value. The type of value stored in the variable are denoted by datatype. There are two types of datatypes used in JS.'),
ChapterTopics(
heading: 'Data types used in JavaScript'),
const ChapterHeadingMedium(
medium_heading: 'a) Primitive data type: '),
HeadingDetails(
contents:
'They are inbuilt datatype used in JS.'),
Table(
border: TableBorder.all(),
columnWidths: const {
0: FixedColumnWidth(
80), // Adjust the width of the first column
},
children: const [
TableRow(
children: [
TableCell(
child: Center(child: Text('Data Type')),
),
TableCell(
child: Center(child: Text('Function')),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('Number')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
'It represents numeric values, including integers and floating-point numbers. BigInt can be used to represent numbers with large values.'),
),
),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('String')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
'It represent alphanumeric values i.e. text'),
),
),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('Boolean')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
'It represent either true or false value.'),
),
),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('Null')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
' It represent empty or unknown value.'),
),
),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('Undefined')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
' If variable is declared but the value is not assigned then the variable is of undefined type.'),
),
),
),
],
),
],
),
const ChapterHeadingMedium(
medium_heading: 'b) Non-Primitive datatype:'),
HeadingDetails(
contents:
'They are the derived datatypes from primitive datatype.'),
Table(
border: TableBorder.all(),
columnWidths: const {
0: FixedColumnWidth(
80), // Adjust the width of the first column
},
children: const [
TableRow(
children: [
TableCell(
child: Center(child: Text('Data Type')),
),
TableCell(
child: Center(child: Text('Function')),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('Array')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
' It store multiple values of same type under a same name.'),
),
),
),
],
),
TableRow(
children: [
TableCell(
child: Center(child: Text('Object ')),
),
TableCell(
child: Padding(
padding: EdgeInsets.all(
8.0), // Add padding to the right column
child: Center(
child: Text(
' It has methods and properties.'),
),
),
),
],
),
],
),
ChapterTopics(heading: 'Variables in JavaScript'),
HeadingDetails(
contents:
' Variables in JavaScript are declared by using keyword "var". for eg, \nvar a=3,b=4;\nvar fruit = "apple"; '),
ChapterTopics(
heading: 'Types of variable in JavaScript'),
const ChapterHeadingMedium(
medium_heading: 'a) Local variable '),
HeadingDetails(
contents:
'Those variable which are declared inside the block or function is called local variable. Local variable can only be accessed and used within the block or function.'),
Image.asset("images/unit_3/e6.png"),
HeadingDetails(
contents:
"In above example, the variable 'a' is declared inside the function disp(). So, it can be used only within the function block. Other function or block cannot use the value of 'a'. Hence, to overcome this limitation we have global variable.",
),
const ChapterHeadingMedium(
medium_heading: 'b) Global variable'),
HeadingDetails(
contents:
'Those variable which are declared outside the block or function is called global variable. Global variable can be accessed and used within any other function or the block.',
),
Image.asset("images/unit_3/e7.png"),
HeadingDetails(
contents:
"In above example, the variable 'a' is declared outside the two function disp() and cisp(). So, it can be used by both function block. When user press Click me then, disp() function is called, this function will display the value of 'a' i.e. 5 which is declared outside of the function. Similarly, when user press Push me then, cisp() function is called, this function will also display the value of 'a' i.e. 5. This is because variable ‘a’ is declared outside of function or block which can be used by any number of function or block. Note: Block represent the statement written inside curly bracket { }",
),
ChapterTopics(
heading: 'form validation in javascript'),
HeadingDetails(
contents:
'Once the client or user entered all the necessary data and press the submit button then all the data entered by the client must be correct and valid. Thus, form validation is the mechanism which allows client to enter only the correct information which can be send to the server. JavaScript provides easy method for form validation at client side. Forma validation can be done in two ways: Basic validation which checks whether all the required fields are filled properly or not kept empty whereas, Data Format validation check whether the data entered into the form field are logically correct.'),
ChapterTopics(
heading: 'Basic form validation in JavaScript',
),
Image.asset("images/unit_3/e8.png"),
ChapterTopics(
heading: 'DDL DML and DCL with example'),
HeadingDetails(
contents:
'SQL stands for Structured Query Language. It is an international standard database query language introduced and developed by IBM in early 1970s. It was able to control relational database. SQL is not a complete programming language rather only used for communicating with database. SQL has several statement for data definition, data manipulation and data control generally known as DDL, DML and DCL respectively. A query is a request to a DBMS for the retrieval, modification, insertion and deletion of the data from database.'),
Image.asset("images/unit_3/sql.jpg"),
ChapterTopics(heading: 'DDL DML and DCL statements'),
const ChapterHeadingMedium(
medium_heading:
'1) Data Definition Language (DDL)'),
const ChapterHeadingMedium(
medium_heading: '1.1 CREATE statement'),
HeadingDetails(
contents:
'In order to create a database we can use CREATE statement as follows:'),
Image.asset("images/unit_3/e9.png"),
HeadingDetails(
contents:
'The above statement will create a database with the name student.\nIn order to create a database table we can use CREATE statement as follows:'),
Image.asset("images/unit_3/e10.png"),
HeadingDetails(
contents:
'The above statement will create a database table named student with two column SN and Fname. The number of column can be increased accordingly.'),
const ChapterHeadingMedium(
medium_heading: '1.2 DROP statement'),
HeadingDetails(
contents:
'It is used to delete database or table from the SQL server.'),
Image.asset("images/unit_3/e11.png"),
HeadingDetails(
contents:
'This statement will delete database named student from the SQL server.'),
Image.asset("images/unit_3/e12.png"),
HeadingDetails(
contents:
'This statement will delete database table named student from the SQL server.'),
const ChapterHeadingMedium(
medium_heading:
'2) Data Manipulation Language (DML)'),
HeadingDetails(
contents:
'DML is related with manipulation of records such as retrieval, sorting, displaying and deleting records or data. It helps user to submit query and display report of the table. It provide technique for processing the database. It includes commands like SELECT, INSERT, DELETE and UPDATE to manipulate the information stored in the database.'),
const ChapterHeadingMedium(
medium_heading: '2.1) SELECT statement'),
Image.asset("images/unit_3/e13.png"),
HeadingDetails(
contents:
'This statement will select all the columns from the database table named student.'),
const ChapterHeadingMedium(
medium_heading: '2.2) INSERT statement'),
Image.asset("images/unit_3/e14.png"),
HeadingDetails(
contents:
'The above statement will insert 3 and Ram into the database table named student.'),
const ChapterHeadingMedium(
medium_heading: '2.3) DELETE statement'),
Image.asset("images/unit_3/e15.png"),
HeadingDetails(
contents:
"This statement will delete all the records from the student table where the Fname value is 'Ram'."),
const ChapterHeadingMedium(
medium_heading: '2.4) UPDATE statement'),
Image.asset("images/unit_3/e16.png"),
HeadingDetails(
contents:
'This stament will update the update the table record whose fname is "Ram".'),
const ChapterHeadingMedium(
medium_heading: '3) Data Control Language (DCL)'),
HeadingDetails(
contents:
'DCL provides additional feature for security of table and database. It includes commands for controlling data and access to the database. Some of the example of this command are GRANT, COMMIT etc.'),
],
),
),
),
),
),
)
],
),
bottomNavigationBar: _isAdLoaded
? SizedBox(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit1.dart
|
// ignore_for_file: must_be_immutable, non_constant_identifier_names
import 'package:computer_12/widgets/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bulleted_list/bulleted_list.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
class DataBase extends StatefulWidget {
const DataBase({super.key});
@override
State<DataBase> createState() => _DataBaseState();
}
class _DataBaseState extends State<DataBase> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
//advertisment
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
///content.............
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
elevation: 25.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: const Text(
'Unit 1',
style: TextStyle(color: Colors.white, fontSize: 28),
),
),
body: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: CupertinoScrollbar(
thickness: 10.0,
thumbVisibility: true,
thicknessWhileDragging: 10.0,
child: InteractiveViewer(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
chapterHeading(),
const SizedBox(
height: 8.0,
),
ChapterTopics(
heading: 'Data',
),
const SizedBox(
height: 5.0,
),
HeadingDetails(
contents:
"Data is raw fact or figure or entity. When activities in the organization take place, the effect of these activities need to be recorded which is known as data. Thus, the quantities, symbols, or characters on which operations are performed by a computer, which may be stored and transmitted in the form of electromagnetic or electrical signals and recorded on storage devices such as magnetic, optical, or mechanical recording media.",
),
const SizedBox(
height: 8.0,
),
const SelectableText(
'Eg. Chanakya, 32, 601 → Raw facts',
textAlign: TextAlign.justify,
style: TextStyle(
// fontWeight: FontWeight.normal,
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: "Information"),
const SizedBox(
height: 5.0,
),
HeadingDetails(
contents:
"Processed data is called information. The purpose of data processing is to generate the information required for carrying out the business activities. In other words, information is knowledge that derived from data, which have been transformed, interpreted, stored and used for some purposes. With that information we can find out what we don't know before and it will affect what we already know."),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"Besides, we can make a right decision. Decisions are impossible without information andusers are constantly seeking more and better information to support decision making. It also can reduce the sense of doubt and a sense of uncertainty about the event. For example, accounting information is very important for a company to be able to determine the profit or loss of the business"),
const SizedBox(
height: 6.0,
),
const SelectableText(
'Eg',
textAlign: TextAlign.left,
style: TextStyle(fontSize: 17.0),
),
Image.asset("images/eg1.jpg", height: 120),
const SizedBox(
height: 17.0,
),
ChapterTopics(heading: 'Database'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
'A database is a collection if interralated data of objects or entities stored in tabular form. Database gives very useful information for an organiation during data manipulation and decision making.It is actually a single organized collection of structured data. The data in the database are always common to all the users of the system. A very simple example of database is telephone diary. Thus database is a collection of related data. For example:- phone diary, Result Sheet, Price list, customer record etc.'),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Functions of Database'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"i. Storing, manipulating and managing information.\nii. Reducing repeated storage of data\niii. Keeping latest and correct information.\niii. Keeping latest and correct information.\niv. Providing data security.\nv. Improving disk optimization.\nvi. Fast accessing of data"),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Database Management System'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
'DBMS is a collection of program that enables user to create and maintain a database. The collection of data is usually database which contains the informatin about any particular organization and set of programs is special type language to manage more database. DBMS is a general purpose software system that facilities the process of defining, constructing and manipulating database for various application. A DBMS handles user request for database actions and allows for control of security and data integrity requirement. DBASE, MS Access, SQL, Oracle etc are some software package to work with DBMS.\nFor Example:- Foxpro,Dbase, Sybase, ms Access, mySQL, msSQLserver etc.'),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Objectives of DBMS'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"1. Providing very easy access to data for user. \n2. Providing very fast response to user request for any data. \n3. Removing any duplicate data. \n4. To provide huge space for storage of relevant data. \n5. To facilitate more than one user to use same data at a same time. \n6. To give protection to the data against unwanted access, unauthorized access and any Nepal kind of physical harm. "),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Advantages of DBMS'),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: '1.Sharing Data',
),
const SelectableText(
"Data stored in a database can be stored. It refers to the capacity that makes data simultaneously accessible by many user without any interferences.",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'2.Reduce data and redudancy',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"The same data may be duplicated at many times or places is called data redudancy. DBMS reduce such types of duplication of data from database."),
const SizedBox(
height: 6.0,
),
const Text(
'3.Data backup and recovery',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SelectableText(
"DBMS provides backup facilities to store data for future use. If any files or data lost in any computer, it is possible to restore them from database server.",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'4.Inconsitency avoided',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"When the same data is duplicated and change are made at one side, and not on other side, it cause data inconsistency. DBMS avoided such types of data inconsistency."),
const SizedBox(
height: 6.0,
),
const Text(
'5.Data integrity',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"Data integrity means data according, consistency and upto date. A DBMS should provide capabilites for defining and enforcing constraints for data integrity."),
const SizedBox(
height: 6.0,
),
const Text(
'6.Data Security',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
const Text(
'7.Data independence',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
const Text(
'8.Multiple Complex Query',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(
heading: 'Difference Between Database and DBMS'),
const SizedBox(
height: 6.0,
),
Image.asset('images/unit_1/data_dbms.jpg'),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Models of Database'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"There are different forms of database management system, each characterized by the way where data are defined and structured called database model. It is organizing principles of records in secondary storage.\nDifferent Models of database are given below:-"),
const SizedBox(
height: 6.0,
),
ChapterTopics(heading: '1. Hierarchical Database Model'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"It is a database model in which records are grouped in such a way that their relationships form a branching, tree like structure. In very simple language this types of database model orgranizes data in top down structures that resembles tree. It is the easiest model. It has one or more attributes. If parent is known then searching is easy and fast."),
const SizedBox(
height: 6.0,
),
Image.asset('images/unit_1/eg.3.png'),
const SizedBox(
height: 20.0,
),
const Text(
'Fig:- Hierarchical Database Model',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
// decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Advantages'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. It is most simplest and easiest database model.\n2. If parent is known then searching is easy and fast.\n3. Database security is said to be good because we can't modify, delete a child without consulting its parent.\n4. It is efficient to handle 1 to many relationship.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
),
),
ChapterTopics(heading: 'Disavantages'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. This model nowadays has become an outdated model.\n2. This model cannot handle many to many relationship.\n3. When parent mode is deleted, child are automatically deleted.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: '2. Network Database Model'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"It is a database model in which records are grouped in such a way that their relationships form a branching, tree like structure. In very simple language this types of database model orgranizes data in top down structures that resembles tree. It is the easiest model. It has one or more attributes. If parent is known then searching is easy and fast."),
const SizedBox(
height: 6.0,
),
Image.asset('images/unit_1/eg4.png'),
const SizedBox(
height: 20.0,
),
const Text(
'Fig:- Network Database Model',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
// decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Advantages'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. It is able to handle many to many relationship.\n2. Searching is generally fast due to the presence of multidirectional pointer.\n3. Data redundancy is reduced because same data is not needed again and again.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
),
),
ChapterTopics(heading: 'Disadvantages'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1.It is too complex, because database administrator, programmer must be familiar with internal structure in order to access the database.\n2. There is need of long programs to handle relationship.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
ChapterTopics(heading: '3. Relational Database Model'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"In relational database model, the data is organized into tables which contain multiple rows and columns. These tables are called relation. A row in a table represents a relationship among a set of values. Since a table is a collection of such relationships, it generally reterred to the mathematical term relation, form which the relational database model derives its name. It is also known as RDBMS. Database processing is faster that other model. There is very less redundancy."),
const SizedBox(
height: 6.0,
),
Image.asset('images/unit_1/eg5.png'),
const SizedBox(
height: 6.0,
),
Image.asset('images/unit_1/eg6.png'),
const SizedBox(
height: 20.0,
),
const Text(
'Fig:- Network Database Model',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Advantages'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. There are few redundancy in this database model.\n2. Normalization of database is possible.\n3. The database processing is also very fast.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
),
),
ChapterTopics(heading: 'Disadvantages'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. It is the most complex database model.\n2. Here are too many rules which makes this database model non-user friendly.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Normalization'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
" Normalization is a database design process in which complex database table table is broken down into simple seprate tables to make data model more flexible and easier to maintains. It makes data model more flexible and easier to maintain. There are two goals of the normalization process: eliminating redundant data and ensuring data dependencies make sense.\n\nThere are three types of Normalization:-\n\n1.First Normal Form(1NF)\n2.Second Normal Form(2NF)\n3.Third Normal Form(3NF)"),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: '1. First Normal Form(1NF)'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Second Normal Form (2NF) futher address the concept of removing duplicate data: \n",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
color: Colors.black,
),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 0.1),
child: BulletedList(
listItems: [
'Table or relation must be in 1st Normal Form.',
'All the non-prime attributes should be fully functionally dependent on primary key.',
// TextStyle(color: Colors.black)
],
bulletColor: Colors.black,
style: TextStyle(
fontSize: 17.0,
color: Colors.black,
),
),
),
const SizedBox(
height: 20.0,
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: '2. Second Normal Form(2NF)'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Second Normal Form (2NF) futher address the concept of removing duplicate data: \n",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17.0,
// color: Colors.black,
),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 0.1),
child: BulletedList(
listItems: [
'Table or relation must be in 1st Normal Form.',
'All the non-prime attributes should be fully functionally dependent on primary key.',
],
bulletColor: Colors.black,
style: TextStyle(fontSize: 17.0, color: Colors.black),
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: '3. Third Normal Form(3NF)'),
const Padding(
padding: EdgeInsets.symmetric(vertical: 0.1),
child: BulletedList(
listItems: [
'Relation must be in Second Normal Form.',
'For any non-trival function dependency, x-->A, then either x is a prime number or X is a super key.',
],
bulletColor: Colors.black,
style: TextStyle(fontSize: 17.0, color: Colors.black),
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(
heading:
'Difference Between Centralized database and Distribution Database'),
const SizedBox(
height: 6.0,
),
Image.asset('images/unit_1/eg222.jpg'),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Data Base Administrator(DBA)'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"Data base administrator is the person who manages the data base. The DBA determine the content, internal structure and access strategy for a data base, defines security and integrity and monitors performance.\n\nA DBA has to possess the following:-\n\ni. Knowledge of query language(SQL).\nii. Knowledge of various operating system on which data base server can run and is running.\niii. Knowledge in designing the data base.\niv. Knowledge about network architecture."),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Resposibility of Data Base(DBA)'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"There are following responsibility of a database administrator:-\n\ni. DBA should give idea to an organization on deciding which department will be looking on maintenance and update of data in the database.\nii. DBA has to assure 24 hour access to each department in the organization that needs the data.\niii. DBA has to install and timely upgrade the data base server.\niv. DBA has to use storage space available for data in an effective manner.\nv. DBA has to make proper backup and also to develop recovery procedure in case the DBMS crashes/malfunctions.\nvi. DBA also has to make sure that database server is giving optimum performance.\nvii. DBA has to work with the developers and need to assist in designing the overall data base.\nviii. DBA has to manage all the user who use data base and determine proper security level for each user."),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'SQL'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"Data base administrator is the person who manages the data base. The DBA determine the content, internal structure and access strategy for a data base, defines security and integrity and monitors performance.\n\nA DBA has to possess the following:-\n\ni. Knowledge of query language(SQL).\nii. Knowledge of various operating system on which data base server can run and is running.\niii. Knowledge in designing the data base.\niv. Knowledge about network architecture."),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Resposibility of Data Base(DBA)'),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"There are following responsibility of a database administrator:-\n\ni. DBA should give idea to an organization on deciding which department will be looking on maintenance and update of data in the database.\nii. DBA has to assure 24 hour access to each department in the organization that needs the data.\niii. DBA has to install and timely upgrade the data base server.\niv. DBA has to use storage space available for data in an effective manner.\nv. DBA has to make proper backup and also to develop recovery procedure in case the DBMS crashes/malfunctions.\nvi. DBA also has to make sure that database server is giving optimum performance.\nvii. DBA has to work with the developers and need to assist in designing the overall data base.\nviii. DBA has to manage all the user who use data base and determine proper security level for each user."),
const EndingText(),
],
),
),
),
),
),
),
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit6.dart
|
// ignore_for_file: deprecated_member_use
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:url_launcher/url_launcher.dart';
import '../widgets/widgets.dart';
class SpM extends StatefulWidget {
const SpM({super.key});
@override
State<SpM> createState() => _SpMState();
}
class _SpMState extends State<SpM> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
// custom text style and text color
var defaultText = const TextStyle(
color: Colors.black,
fontSize: 14.0,
fontStyle: FontStyle.italic,
);
var linkText = const TextStyle(
color: Colors.blue,
fontSize: 14.0,
fontStyle: FontStyle.italic,
);
/////main content
@override
Widget build(BuildContext context) {
return SafeArea(
top: true,
child: Scaffold(
appBar: AppBar(
elevation: 25.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: const Text('Unit 6',
style: TextStyle(fontSize: 30, color: Colors.white)),
),
body: PageView(
children: [
GestureDetector(
child: CupertinoScrollbar(
thickness: 10.0,
thumbVisibility: true,
thicknessWhileDragging: 10.0,
child: InteractiveViewer(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
chapterHeading(),
sourceLinks(),
const SizedBox(
height: 8.0,
),
ChapterTopics(
heading: 'Software process model',
),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"The term system is derived from the Greek word ’systema’ which means took place together i.e system is an organized relationship among functioning of all units. It is a set or arrangement of things so related or connected as to form unity. In order to achieve common objective. In other word, system is a set element joint together for common objective. Thus, we can define a system as collection elements or components that are organized together for common purpose in order to enable the flow of information. System can be combination of people, device, process and method interrelated in such a fashion that they all work together for common goal. Some example of system are :\n1. Open system [example: biological system]\n2. Close system [example: nuclear weapon]\n3. Permanent system [example: government policy]\n4. Temporary system [example: small group research project in the laboratory]\n5. Natural system [example water cycle, ecosystem etc]\n6. Manufactured system [example: transportation, manufacturing system "),
const SizedBox(
height: 20.0,
),
const Text(
"Basic interacting components of a system.",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
Image.asset("images/unit_6/component_system.png",
height: 120),
const SizedBox(
height: 6.0,
),
const Text(
'1.Input: ',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"It involves capturing and assembling element that enter the system to be processed. For eg, the input to a calculator is the keypad. We press keys and the keypad sends an electric signal to be processed. ",
),
const SizedBox(
height: 6.0,
),
const Text(
'2. Process: ',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
" It involves transformation processes that converts input into output. The input signal are changed according to the instruction supplied to generate an output."),
const SizedBox(
height: 6.0,
),
const Text(
'3.Output: ',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
" It involves elements that have been produced by a transformation process to their final and ultimate destination. The output of a calculator is the screen."),
const SizedBox(
height: 6.0,
),
const Text(
'4.Storage:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"Storing for future so that we can retrieve and access whenever required."),
const SizedBox(
height: 6.0,
),
const Text(
'5.Controlling:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
HeadingDetails(
contents:
"Monitoring the overall data and resources flow is known as controlling."),
const SizedBox(
height: 6.0,
),
const Text(
'6.Feed back:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"Feedback is the idea of monitoring current output of the system and comparing it with the system goal."),
const SizedBox(
height: 6.0,
),
const SizedBox(
height: 6.0,
),
const Text(
'7.System boundary: ',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"The system boundary defines the components that make up the system and scope of the organization which can be changed during system design."),
const SizedBox(
height: 6.0,
),
const SizedBox(
height: 6.0,
),
const Text(
'8.System Environment:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"Anything outside the system boundary that may directly or indirectly affect the system behavior is system environment."),
const SizedBox(
height: 20.0,
),
const Text(
"System Development Life Cycle (SDLC)",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
),
),
Image.asset("images/unit_6/software_develop.png"),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
"System is defined as an integrations of objects of the real world environment joined in some regular interaction. The process of developing system by set of predefined steps is called system development life cycle. We need system development lifecycle due to following reasons. Computer based processing enables the same data to be processed in many ways according to the need.\n\n1. It is easier to handle large volume of data and deal with variety of information.\n2. It is easier to handle organization having distributed branches."),
const SizedBox(
height: 6.0,
),
const Text(
'1) System investigation:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"It is the preliminary way of handling the user request to change, improve or enhance existing system. The objective is to determine the user requirement, whether the request is valid and feasible. In this phase, problem definition is well understood, as system intended to meet the need of an organization. Thus, the first step in the design is to specify these needs for requirements. The top manager of an organization takes the basic decision to use a computer based information system for managing the organization. During this phase the objective of the system are identified. In general system Investigation studies the following questions. What is to be done in the future?\nHow to do it?\nWhen to do it?\nWho will do it?"),
const SizedBox(
height: 6.0,
),
const Text(
'2) System analysis:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"The process of analyzing a system and trying to find a way to modify it or create a new system to meet the users need. In other words, the investigation into system operation and possible changes to the system is called system analysis. The system are made up of many interrelated task, change to any one of this task to the addition of new task may affect the existing one. Therefore, it is necessary to understand the system and its problem which will help to reduce the failure due to any risk and uncertainties. Main activities which are undertaken in this phase.\n1. Definition of output requirements such as content, layout design etc.\n2. Specification of input data such as source, format etc.\n3. Development of overall logic.\n4. Develop step by step algorithm and flowchart.\n5. Develop a general test requirement"),
const SizedBox(
height: 6.0,
),
const Text(
'3) Feasibility studies (V.imp):',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"The process of analyzing whether the proposal is feasible or not is known as feasibility study. If it is not feasible then we have to look after other alternative. Feasibility study mainly focus on the demand of the system that affects the overall the development of the information system. Feasibility is how beneficial or practical the development of an information system will be to an organization.\n\nThe aim of feasibility study Are:-\n\n1. To determine whether the objective stated can be early attainable within a prescribe limitation and period.\n2. To define major problem areas so that system analyst can plan the strategy for the field investigation.\n3. To find areas where we can save time money and effort..\n4. To prepare cost estimation and time scheduling.\n5. To discover the areas where specialist knowledge are required."),
const SizedBox(
height: 20.0,
),
const Text(
'Different types of feasibility study. ',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'a) Economic feasibility:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"The system development said to be economically feasible if the budget on proposed system doesn't ought weight, the estimated cost involve in acquiring, installing and operating it. Cost can be one time or continuing and can occur at various time during project development and use. It mainly measures cost, savings, and benefits. During economic feasibility the cost of the following things are to be measured..\n1. People including IT staff and user.\n2. Hardware and equipmen.\n3. Softwar.\n4. Formal and informal trainin.\n5. License and fee.\n6. Facility cost"),
const SizedBox(
height: 6.0,
),
const Text(
'b) Schedule feasibility (time):',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"A system development is said to be schedule feasible if time required to accomplish the project doesn't cross the proposed deadline. It is called schedule feasibility. The schedule feasibility also depends upon available manpower and economical condition as well. In practice, time period of project completion should be always less than or equal to time required then proposed time, then only the system will be schedule feasible."),
const SizedBox(
height: 6.0,
),
const Text(
'c) Technical feasibility:',
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
HeadingDetails(
contents:
"A system development is said to be technically feasible if the organization has the resources to develop or purchase, install and operate the system. It measures the availability of appropriate manpower required to accomplish the project. If the manpower used are not technical or the work performance of the technical manpower are not experienced the entire system will be certainly insufficient and this will distract the achievement of its goals and objectives, Technical feasibility measures following things.\n1. Does the company have the need of technical expertise? If not can it be acquired ?\n2. Does the company have necessary hardware, software and network resources?",
),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: 'd) Operational feasibility:',
),
HeadingDetails(
contents:
'A system that has operational feasibility is one that will be used effectively after it has been developed. If user have difficulty with a new system it will not produce the expected benefit. Operational feasibility depends on several issues. Some are performance of employees, information, economy, control, efficiency and service. A system which is operationally feasible will win it day to day activities smoothly without any delay and disturbance.',
),
const ChapterHeadingMedium(
medium_heading: '4) System design: '),
HeadingDetails(
contents:
'System design is the process of creating alternative solutions to satisfy the investigated goals, evaluating the choices and drawing up the specification for the chosen alternative. Design begins after the study team has analyzed the current procedure. Since many factor have been bearing on the design process, it can be challenging. After analyzing the current system the job of the designer is to decide whether the benefits and possible savings expected from design alternative out weigh the cost. There are several designing tool. Some of them are algorithm, flowchart, ER diagram etc,',
),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: 'Algorithm'),
HeadingDetails(
contents:
'The sequential system steps written in order to solve a particular problem is known as algorithm. Eg, Algorithm to find greatest number among two numbers.'),
HeadingDetails(
contents:
'Step 1: Start\nStep 2: Enter any two number (a, b)\nStep 3: Check whether (a>b)\n\t\t\t\t\t\t\t\t\t\t\tIf true: Go to step 4 and stop\n\t\t\t\t\t\t\t\t\t\t\tIf false: Go to step 5 and stop\nStep 4: Display greatest number is ‘a’\nStep 5: Display greatest number is ‘b’\nStep 6: Stop',
),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: 'Flowchart'),
HeadingDetails(
contents:
' The diagrammatic representations of steps involved while solving a particular problem is called flowchart.',
),
const ChapterHeadingMedium(
medium_heading:
'5) System Development (Coding): '),
HeadingDetails(
contents:
'Coding the process of writing programs using actual programming language. In the phase solutions are created using real program code. In general, the system design needs to be implemented to make it a workable system. This demands the coding of design into computer language i.e. programming language (machine level language, high level language, assembly language). This is also called the programming phase in which the programmer converts the program specification into computer instruction, which we refer to as program. The programs co-ordinate the data movement and control the entire process in a system. A well written code reduces the testing and maintenance effort. This helps in fast development, maintenance and future changes if required programming tools like compiler, interpreter and languages like C, C++, Java script, PHP etc are used for coding. With respect to the type of application, appropriate programming language should be chosen.',
),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: '6) System Testing :'),
HeadingDetails(
contents:
"This steps includes whether the developed system can fulfill the user requirement or not. The testing is the process of validating the correctness of program. It's objective is to demonstrate that the program meets its designed specification. It is an investigation conducted to provide stake holder with information about the quality of the product or service under test. Some of the objective of system testing are :\n\n1. To check whether developed system fulfills the user requirement or not.\n2. To check whether developed system works as expected.",
),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading:
'Some testing methods are:\na) Black box testing:'),
HeadingDetails(
contents:
'Black box testing treats the software as a black box without any knowledge of internal implementation. It is also called functional testing because it tests whether a system is functioning or not. Here in this type of testing several known input is provided and checked whether the system generates expected output or not.',
),
const ChapterHeadingMedium(
medium_heading: 'b) White box testing:f'),
HeadingDetails(
contents:
'In white box testing, procedural details are checked logical path through the software and between several components are tested through codes, statements and syntax analysis. White box testing is used when the tester has to the internal data structure and algorithms including the code that implement this. It is also called glass box testing.',
),
const ChapterHeadingMedium(
medium_heading: '7) System implementation: '),
HeadingDetails(
contents:
'The main objective of this phase is to obtain an operational system fully documented. In the phase system are installed and tested with operational data. It also consist of implementation of the system into production environment and resolution of the problem identified in testing phase. Implementation generally refers to the use of newly developed system in practice. when the software appears to be running properly then we understand it is ready to implement. The main activities of implementation phase are:\n\n1. Testing and proving in all parts of system.\n2.Training of data processing and user staff to use the new system.\n3.Preparation of documentation of a system.\n4.Acquiring all necessary equipment & stationary.'),
const ChapterHeadingMedium(
medium_heading: '8) System maintenance: '),
HeadingDetails(
contents:
'When the system is implemented, maintenance and modification begins. like any system, there is an aging process that requires periodic maintenance of hardware and software. There may be need of new modification which are done in this phase. The software and hardware requires periodic maintenance to as to keep in tune with design specification and to innovate new ideas into the system. The different types of maintenance are:\n\n1. Corrective maintenance: It corrects the run-time error during the operation.\n2. Adaptive maintenance : It modifies or add new feature in the system according to the environmental change.\n3. Perfective maintenance. It makes the system perfect up to date and improve the life and efficiency of the system.',
),
// ChapterHeadingMedium(medium_heading: '')
const SizedBox(
height: 6.0,
),
ChapterTopics(heading: 'System Development Model'),
const ChapterHeadingMedium(
medium_heading: 'A) The waterfall Model: '),
HeadingDetails(
contents:
'This model is some time called classic life cycle because it suggest a systematic sequential approach to software development that begins with customer specification of requirements and progress through planning, modeling, construction etc. It is an oldest type of model for software engineering. It takes the fundamental process activities of specification, development, validation and evolution & represents them as separate process phases such as requirements specification, software design, implementation testing and so on.',
),
Column(
children: [
Image.asset(
"images/unit_6/sdlc.png",
),
const Text('Fig:- Waterfall Model'),
],
),
const SizedBox(
height: 6.0,
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading:
'a. Requirement analysis & definition:'),
HeadingDetails(
contents:
" In this stage the system's services constrain and goals are established by consultation with system users. They are defined in details and serve as system specification.",
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'b. System and software design:'),
HeadingDetails(
contents:
'In this stage the system design process partition the requirements to either hardware or software system. It establishes overall system architecture. Software design involves identifying and describing the fundamental software system abstraction and their relationship.'),
const ChapterHeadingMedium(
medium_heading:
'c. Implementation and unit testing:'),
HeadingDetails(
contents:
'During this stage, the software design is realized as a set of programs or program unit testing involves verifying that each unit meets its specification.'),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading:
'd. Integration and system testing:'),
HeadingDetails(
contents:
'Normally, this is the longest life cycle phase. The system is the installed and put into practical use, maintenance involves correcting errors which are not discovered in earlier stage of the life cycle improving the implementation of system units and enhancing the system service as a new requirements are discovered.',
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'B) Prototyping Model:'),
HeadingDetails(
contents:
"This model is applied when there is an absence of detail information regarding input and output requirement of a software. Prototype model is suitable when the requirement of the client is not clear and it is supposed to be changed. It doesn't cover any risk management.",
),
ChapterTopics(heading: 'Development of prototype.'),
const ChapterHeadingMedium(
medium_heading: 'Identify user problem:'),
HeadingDetails(
contents:
"The system analyst interviews the user to obtain an idea of what is required from the system.",
),
const ChapterHeadingMedium(
medium_heading: 'Develop a prototype: '),
HeadingDetails(
contents:
"The system analyst, working with other information specialist uses one or more prototyping tool to develop a prototype.",
),
const ChapterHeadingMedium(
medium_heading:
'Determine if prototype is acceptable:'),
HeadingDetails(
contents:
"The system analyst educates the user in prototype and provides an opportunity becoming familiar with the system. The user advises the analyst whether the prototype is satisfactory or not. If yes then the prototype will be used if not again the loop continues from beginning.",
),
const ChapterHeadingMedium(
medium_heading: 'Use the prototype:'),
HeadingDetails(
contents:
"The prototype becomes operational system.",
),
const ChapterHeadingMedium(
medium_heading:
'Advantages of prototyping model'),
HeadingDetails(
contents:
"1. Helps in reducing risk associated with the the project.\n2. There is great involvement of user in software development.",
),
const ChapterHeadingMedium(
medium_heading:
'Disadvantages of prototyping model'),
HeadingDetails(
contents:
"1. Time consuming and expensive because if the user is not satisfied by the developed prototype new prototype should be developed.\n2. This process goes on until a perfect prototype is developed which satisfies the user.",
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'C) Spiral model:'),
HeadingDetails(
contents:
" In this model, process is represented as a spiral rather than a sequence of activities with back tracking. Each loop in the spiral represent a phase in the process. It has no fixed phase such a specification or design. Loops in the spiral are chosen depending upon what is required. This model combines the feature of both waterfall model and prototype model. The spiral model is favorable of large, expensive and complicated projects. It is a system development method in Looping structure. In this model planning, risk analysis, software development and user evaluation are repeatedly processed until the system performed correct output.",
),
Column(
children: [
Image.asset(
"images/unit_6/sprialmodel.png",
),
const Text('Fig:- Spiral Model')
],
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'Planning:'),
HeadingDetails(
contents:
' The project is reviewed and the decision is made whether to continue with a further loop of a spiral. If it is decided to continue, plan has to be drawn up for the next phase of the project.',
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'Risk analysis:'),
HeadingDetails(
contents:
'For each of the identified project risk, detail analysis is carried out. Steps are taken to reduce the risk. For example: if there is a risk that the requirement are inappropriate, a prototype system may be developed.',
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'Software development: '),
HeadingDetails(
contents:
'After risk evaluation a development model of the system is chosen.',
),
const SizedBox(height: 6.0),
const ChapterHeadingMedium(
medium_heading: 'User evaluation: '),
HeadingDetails(
contents:
'Specific objective for the phase of the project are defined by the evolution of the user. Here, user requirement and the product are identified and checked whether it fulfills the specification or not.',
),
const ChapterHeadingMedium(
medium_heading: 'Advantages of spiral model'),
HeadingDetails(
contents:
'1. It emphasize on risk, which are often ignored.\n2. Some phases are in loop, it is effective for regular updates.3. Effective user feedback.4. It emphasize on quality.',
),
const ChapterHeadingMedium(
medium_heading: 'Disadvantage of spiral model'),
HeadingDetails(
contents:
'1. Full scale risk analysis need training and maybe expensive. Hence, it is only applicable for large project.\n2. This model is relatively untested.',
),
ChapterTopics(heading: 'System design tool'),
HeadingDetails(
contents:
'Various system design tool are used during system analysis and design phase of system development. Some of the most commonly used tools are algorithm, flowchart, entity relationship (ER) diagram , data flow diagram (DFD) etc.',
),
const ChapterHeadingMedium(
medium_heading: '1) Algorithm:'),
HeadingDetails(
contents:
'The sequential steps or step by step procedure written to solve particular problem is called algorithm. It is one of the most basic tools used for solving problem. It is defined as the finite sequence of instruction for solving a problem. It consists of step wise list of English statement making sequential procedure. The number of instruction should be minimized to increase the speed of an algorithm.'),
const ChapterHeadingMedium(
medium_heading: '2) Flowchart:'),
HeadingDetails(
contents:
'The pictorial or diagrammatic representation of steps involved while solving problem. It is defined as a diagram or picture which describe the procedure how to solve a problem. It shows the order of instruction and relationship between them. The purpose of constructing flowchart is to help the programmer for understanding the logic of the problem. There are two types of flow chart.',
),
const ChapterHeadingMedium(
medium_heading: 'Program Flowchart:'),
HeadingDetails(
contents:
' It is the type of flowchart that explains how a particular program solves a given tasks. It helps to get an understanding on how to solve the problem using the programs· Since it solves only one type of problem at a time, it is very easy to understand. ',
),
const ChapterHeadingMedium(
medium_heading: 'System flowchart:'),
HeadingDetails(
contents:
'A system flowchart plays vital role in system analysis. It illustrates the elements graphically and characteristics of a system, its structure and relationship in terms of flowchart symbol. A system flowchart is a diagram that shows a broad overview of the data flow and sequences of operation in a system. It is the graphical representation of a sequence of activities in a process of a system.',
),
const EndingText(),
],
),
),
),
),
),
),
],
),
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
),
);
}
Center sourceLinks() {
return Center(
child: RichText(
text: TextSpan(
children: [
TextSpan(
style: defaultText,
text: "Sources:",
),
TextSpan(
style: linkText,
text: "readersnepal.com",
recognizer: TapGestureRecognizer()
..onTap = () async {
var url =
"https://readersnepal.com/e-notes/neb-new-course-class-12/computer-science-3";
if (await canLaunch(url)) {
await launch(url);
} else {
throw "cannot thorw url";
}
},
),
],
),
),
);
}
Padding chapterHeading() {
return const Padding(
padding: EdgeInsets.all(2.0),
child: Text(
"Software Model Process",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit5.dart
|
import 'package:computer_12/strings/string_unit2.dart';
import 'package:computer_12/widgets/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
class OoP extends StatefulWidget {
const OoP({super.key});
@override
State<OoP> createState() => _OoPState();
}
class _OoPState extends State<OoP> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
//defining the textstyle
var headlineText = const TextStyle(
fontSize: 21.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
);
var pragraphStyleText = const TextStyle(
color: Colors.black,
fontSize: 17.0,
);
var pointStyleText = const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 17.0,
);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
elevation: 25.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: const Text('Unit 5',
style: TextStyle(fontSize: 30, color: Colors.white)),
),
body: PageView(
children: [
GestureDetector(
child: CupertinoScrollbar(
thickness: 10.0,
thumbVisibility: true,
thicknessWhileDragging: 10.0,
child: InteractiveViewer(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const Padding(
padding: EdgeInsets.all(2.0),
child: Text(
"Object Oriented Programming",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
),
Text(
sources,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 14.0,
fontStyle: FontStyle.italic,
),
),
const SizedBox(
height: 8.0,
),
ChapterTopics(
heading: 'Object Oriented Programming(OOP)'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Object orinted programming is a programming paradigm in which a program is viewed as a collection of discrete that are self contained collection of (data structures and functions) and that interact with other objects also. The fundamental idea behind OOP is to combine into a single unit both data and functions that operate on the data. Such a unit is called an object. So in OOP, every program is divided into set of objects and all programming activities revolve around the object. Each individual object has its own member function. An object can only access data of its own by the help of its own member function.",
textAlign: TextAlign.justify,
// ignore: deprecated_member_use
toolbarOptions: ToolbarOptions(
copy: true, cut: true, selectAll: true),
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Characteristics of OOP'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Emphasis is on data rather than procedure.\n2. Programs are composed of number of objects.\n3. Functions which operate on data of an object are tied together.\n4. Objects can communicate with each another by the medium of member\nnctions.\n5. Data is hidden and cannot be accessed by external functions.\n6. New data and functions can be easily added whenever necessary.\n7. It follows bottom up approach in the process of programming.",
textAlign: TextAlign.start,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Features/Element of OOP'),
const SizedBox(
height: 6.0,
),
const Text(
'1.Object: ',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SelectableText(
"Object is any entity, things or organization that exits in real world. it consists of two fundamentals characteristics: Its attributes and behaviours such as color, weight, age, types etc. and behaviours such as barking wagging tail etc. ",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'2.Class:',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SelectableText(
"A class is the collection of similar objects which is defined as the template or prototype to define the common attributes and behaviour for all the objects of the class. There are areas of class: public, private and protected. so class is incroporates the concept of data hiding.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'3.Data encapsulation',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SelectableText(
"Encapsulation is a way of organizing data and function into a structure (called class) by concealing(hiding) way the object is implemented.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'4.Data abstraction:',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SelectableText(
"Data Abstraction refers to the conceptual boundaries of an object. so, abstraction is the act of representing essential features without including the background details.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'5.Inheritance: ',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SelectableText(
"The process of creating a new class from on exiting class in which objects of a new class inherits the existing class is known as inheritance.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
ChapterTopics(heading: 'Types of inheritance:'),
const SizedBox(
height: 6.0,
),
const SelectableText(
"There are following tyeps of inhertance:-",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'a. Single inheritance',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The process of creating a class from an existing class is known as single inhertance. There is only one base and only one derived class in single inheritance.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const Text(
'b. Multiple inheritance',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The proces of creating only one new from several existing classes is known as multiple inhertance.There is only one derived class and two or more base classes in multiple inheritance. ",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
Image.asset("images/unit_5/eg11.png", height: 120),
const Text(
'c. Hierarchical inheritance',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The process of creating several classes from only one class is called hierarchical inheritance. There are two or more derived classes and only one base class in hierarchical inheritance.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
Image.asset("images/unit_5/eg22.png", height: 120),
const SizedBox(
height: 6.0,
),
const Text(
'd. Multilevel inheritance',
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 17.0,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"The process of creating a new class from another derived class is called multilevel inheritance.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
Image.asset("images/unit_5/eg11.png", height: 120),
const Text(
'e. Hybrid inheritance',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"It is the combinatin of two or more types of inheritance.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 18.0,
),
const Text(
'6. Polymorphism:',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 17.0,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
fontFamily: "Ubuntu",
),
),
const SizedBox(
height: 6.0,
),
const SelectableText(
"Polymorphism refres the ability of an object to take on different forms depending upon situations. Polymorphism is an important feature of OOP which refers to the ability of an object to take on different forms depending uopn. an opreations may exhibit different behaviours in different instance. The behaviour depends upon the types of fata used in the opreation. It simplifies coding and reduces the rework involved in modifing and developing an application. It is extensively used in implementing inheritance.",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Advantages of OOP '),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. We can eliminate redudant codes by using inheritance feature of oop.\n2. It is very easy for managing complex and large sixe problem.\n3. The most important is the reusability of codes by using the features inheritance.\n4. It follows bottom up approach.\n5. It is efficient for testing and implementation of the system.\n6. It takes less times for the testing and implementaion and maintain the software. ",
textAlign: TextAlign.start,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Disadvantages of OOP '),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. OOP demands more resource to get processed.\n2. It is beneficial only in long run while managing large software projects.\n3. Message passing between many objects is a complex process and difficult to trace and debug.\n4. OOP needs mastery in software engineering and also in programming methodology.",
textAlign: TextAlign.start,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 20.0,
),
ChapterTopics(heading: 'Applications of OOP '),
const SizedBox(
height: 6.0,
),
const SelectableText(
"1. Images processing and pattern Recognition.\n2. Computer Aided design and manufacturing.\n3. Object oriented database management systems.\n4. Internet and web based application.\n5. Mobile Computing.\n6. Data warehouse and data mining.\n7. Digital Electronics. ",
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: "Ubuntu",
fontSize: 17.0,
),
),
const SizedBox(
height: 6.0,
),
const EndingText(),
],
),
),
),
),
),
),
],
),
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
),
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/pages/unit4.dart
|
// ignore_for_file: must_be_immutable
import 'package:computer_12/widgets/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
class ProgrammingC extends StatefulWidget {
const ProgrammingC({super.key});
@override
State<ProgrammingC> createState() => _ProgrammingCState();
}
class _ProgrammingCState extends State<ProgrammingC> {
late BannerAd _bannerAd;
bool _isAdLoaded = false;
@override
void initState() {
super.initState();
_initBannerAd();
}
_initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isAdLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: const AdRequest(),
);
_bannerAd.load();
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
elevation: 25.0,
backgroundColor: const Color(0xff618989),
centerTitle: true,
title: const Text('unit 4',
style: TextStyle(fontSize: 30, color: Colors.white)),
),
body: PageView(
children: [
GestureDetector(
child: CupertinoScrollbar(
thickness: 10.0,
thumbVisibility: true,
thicknessWhileDragging: 10.0,
child: InteractiveViewer(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
TopicsHeadings(
sources: 'Sources: Buddha Publication Pvt. Ltd.',
unit: 'Programming in C',
),
const SizedBox(
height: 8.0,
),
ChapterTopics(heading: 'Functions:'),
HeadingDetails(
contents:
'Functions are the self-contained program that contains several block of statement which performs the defined task. In C language, we can create one or more functions according to the requirements.\n\nUsually, In C programs flows from top left to right bottom of main() functions. We can create any number of functions below that main() functions. These function are called from main() function. Requirement while creating a functions.\n\na) Declare a function\n\nb) Call statement\n\nc) Definition of function.\n\nAfter the function is called from the main(), the flow of control will return to the main() function.\nProgram example of function.',
),
const ImageWidget(imagePath: 'images/unit_4/p1.png'),
const ImageWidget(imagePath: 'images/unit_4/p2.png'),
const ChapterHeadingMedium(
medium_heading: 'Advantages'),
HeadingDetails(
contents:
'1. Big programs can be divided into smaller module using functions.\n2. Program development will be faster.\n3. Program debugging will be easier and faster.\n4. Use of functions reduce program complexity.\n5. Program length can be reduced through code reusability.\n6. Use of functions enhance program readability.\n7. Several developer can work on a single project.\n8. Functions are used to create own header file i.e mero.h\n9. Functions can be independently tested.',
),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: 'Recursive functions: (V.Imp)'),
HeadingDetails(
contents:
'Those function which calls itself is known as recursive function and the concept of using recursive functions to repeat the execution of statements as per the requirement is known as recursion. The criteria for recursive functions are:\n1. The function should call itself.\n2. There should be terminating condition so that function calling will not be for infinite number of time. \n\nProgram example of recursive function',
),
const ImageWidget(imagePath: 'images/unit_4/p3.png'),
const ImageWidget(imagePath: 'images/unit_4/p4.png'),
const SizedBox(
height: 6.0,
),
const ChapterHeadingMedium(
medium_heading: 'Pointer (v-imp)'),
HeadingDetails(
contents:
'Pointers in C are similar to as other variables that we use to hold the data in our program but, instead of containing actual data, they contain a pointer to the address (memory location) where the data or information can be found.\n\nThese is an important and advance concept of C language since, variables names are not sufficient to provide the requirement of user while developing a complex program. However, use of pointers help to access memory address of that entities globally to any number of functions that we use in our program.\n\nImportance of Pointer.\n\n While using several numbers of functions in C program, every functions should be called and value should be passed locally. However, using pointer variable, which can access the address or memory location and points whatever the address (memory location) contains.\n\nPointer declaration\nData_type *variable_name\nEg, int *age;',
),
const ChapterHeadingMedium(
medium_heading: 'Advantages'),
HeadingDetails(
contents:
'1. It helps us to access a variable that is not defined within a function.\n2. It helps to reduce program length and complexity i.e. faster program execution time.\n3. It is more convenient to handle datas.\n4. It helps to return one or more than one value from the functions.\nProgram example:',
),
const ImageWidget(imagePath: 'images/unit_4/p5.png'),
ChapterTopics(heading: 'File Handling in C'),
HeadingDetails(
contents:
'As we know, while program is in execution the content of variables are temporarily stored in main memory i.e. RAM. Data reside temporarily in RAM only at the time of program execution. After the completion of execution data gets erased away which means the data cannot be used for future references. To overcome this problem, file handling comes into existence through which we can store data permanently in our secondary storage and retrieve it whenever in future. Data are stored as datafile in our disk.'),
Column(
children: [
Image.asset(
"images/unit_4/file-handling.png",
),
const Text('Fig:- File handling in C')
],
),
const ChapterHeadingMedium(
medium_heading: 'Opening a data file'),
HeadingDetails(
contents:
'Syntax:\n\n\t\t\tFILE *fptr\n\t\t\tfptr = fopen (“filename” , ”mode”)\n\nWhere, File name can be “library.txt”, “student.dat” ..etc\nMode:\n“w” to write/store data in a data file.\n“r” to display/read/retrieve/access data from a datafile.\n“a” to add/append data in existing datafile.',
),
const ChapterHeadingMedium(
medium_heading: 'Store/write data'),
HeadingDetails(
contents:
'Syntax:\n\n\t\t\tfprintf(fptr,”format specifiers” ,variables);\n\n\t\t\tEg; suppose if we want to store name, \n\t\t\tdisease, age and bed number of a \n\t\t\tpatient then, it is written as \n\n\t\t\tfprintf(fptr , ”%s %s %d %d”, n, d, a, b);\n\n\t\t\tWhere, variable are initialized as:\n\t\t\tchar n[10], d[10];\n\t\t\tint a, b;',
),
const SizedBox(
height: 6.0,
),
HeadingDetails(
contents:
'1) Create a datafile “patient.txt” and store name, disease, age and bed number of a patient.',
),
const ImageWidget(imagePath: 'images/unit_4/p6.png'),
const ChapterHeadingMedium(
medium_heading:
'Read/Display/retrieve/access data from a datafile'),
HeadingDetails(
contents:
'Syntax:\n\n\t\t\tfscanf(fptr , ”format specifiers” ,variables);\n\n\t\t\tEg; suppose if we want to display/ \n\t\t\tread name,disease, age and bed \n\t\t\tnumber of a patient then, it is written as \n\n\t\t\tfscanf(fptr , ”%s %s %d %d”, n, d, &a, &b);\n\n\t\t\tWhere, variable are initialized as:\n\t\t\tchar n[10], d[10];\n\t\t\tint a, b;',
),
const SizedBox(
height: 6.0,
),
const EndingText(),
],
),
),
),
),
),
)
],
),
bottomNavigationBar: _isAdLoaded
// ignore: sized_box_for_whitespace
? Container(
height: _bannerAd.size.height.toDouble(),
width: _bannerAd.size.width.toDouble(),
child: AdWidget(ad: _bannerAd),
)
: const SizedBox(),
),
);
}
}
class ImageWidget extends StatelessWidget {
final String imagePath;
const ImageWidget({
required this.imagePath,
super.key,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Image.asset(
imagePath,
),
const SizedBox(
height: 3.0,
),
],
);
}
}
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/strings/string_unit2.dart
|
//details
String titleText = 'Unit 2';
String topics = 'Data Communication and Networking';
String sources = 'Sources: Buddha Publication Pvt. Ltd.';
//data communications
String headline1 = "Data Communication";
String pragraph1 =
"Data communication is the process of using computing and communication technologies to transfer data from one place to another, or between participating parites. Data communication enables the movement of electronic or digital data between two or more network modes, regardless of geographical location, technological medium or data contents.";
//type of data communications
String headline2 = 'Types of data communicatin mode';
String pragraph2 =
"There are three types of data communication modes which are given below: -\ni) Simplex\nii) Half-Duplex\niii) Full-Duplex";
//explaination
String point1 = "1.Simplex";
String point1Explanations =
"In simplex mode, the commmunication is undirectional, as on a one way street. Only one of the two devices on a link can transmit, the other can only receive. Keyboard and traditional monitors are both examples of simplex. Keyboard can be only intorduce input, the monitor xan only accept the output. ";
String exmaple1 = 'Simples Only A to B\nFig:- Simplex Communication';
String point2 = '2.Half-Duplex';
String point2Explanations =
"In Half-Fuplex mode, each station can both transmit and receive is sending, the other can only receive, anmd vice versa. In this mode, the entire capacity of a channel is taken over by whichever of teo deveices is transmittnig at the time. Wakie-Talkie is the best example of half-duplex system.";
String example2 =
"Half-Duplex A to B or B to A\nFig:- Half-Duplex Communication";
String point3 = '3.Full-Duplex';
String point3Explanations =
"In the Full-Duplex mode, both stations can transmit and receive simultaneously. This mde is like a two way traffic flowing in both directions at the same time. Here, signals going in either direction share the capacity of the link. Telephone network, online chatting are the example of full-duplex.";
String example3 =
'Transmission in both directions simultaneously \nFig:- Full duplex communication';
String headline3 = 'Computer Network';
String pragraph3 =
"Computer Network is defined as the interconnection of two or more computers or networking devices with the help of transmission media and set of protocols.";
String h4 = 'Merits of Computer Network';
String p4 = 'a. Sharing Resource';
String p5 =
"Hardware resources such as processor, storage devices, printers, scanner etc can be shared among us using computer network. It hepls to minimize the operational cost of an organization. Similarly software can be shared among us within a network.";
| 0
|
mirrored_repositories/Flutter_E-Note-App/lib
|
mirrored_repositories/Flutter_E-Note-App/lib/topics/topics.dart
|
import 'package:flutter/material.dart';
import 'package:computer_12/pages/unit1.dart';
import 'package:computer_12/pages/unit2.dart';
import 'package:computer_12/pages/unit3.dart';
import 'package:computer_12/pages/unit4.dart';
import 'package:computer_12/pages/unit5.dart';
import 'package:computer_12/pages/unit6.dart';
import 'package:computer_12/pages/unit7.dart';
class TopicsList extends StatefulWidget {
const TopicsList({super.key});
@override
State<TopicsList> createState() => _TopicsListState();
}
class _TopicsListState extends State<TopicsList> {
///start list view of topics.....
Widget buildCard(String text, VoidCallback onTapFunction) {
final screenSize = MediaQuery.of(context).size;
double textSize = screenSize.width * 0.04;
return GestureDetector(
onTap: () {
onTapFunction();
},
child: Card(
color: const Color(0xff618989),
elevation: 5.0,
child: Padding(
padding: const EdgeInsets.all(30.0),
child: Center(
child: Text(
text,
style: TextStyle(
fontSize: textSize,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: ListView(
children: <Widget>[
const SizedBox(
height: 8.0,
),
buildCard(
'Database',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const DataBase(),
),
);
},
),
const SizedBox(
height: 8.0,
),
buildCard(
'Data Communication and Networking',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const NetWork(),
),
);
},
),
const SizedBox(
height: 8.0,
),
buildCard(
'Web Techonology II',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const WebDevelopment(),
),
);
},
),
const SizedBox(
height: 8.0,
),
buildCard(
'Programming in C',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const ProgrammingC(),
),
);
},
),
const SizedBox(
height: 8.0,
),
buildCard(
'Objected Oriented Programming',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const OoP(),
),
);
},
),
const SizedBox(
height: 8.0,
),
buildCard(
'Software Process Model',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const SpM(),
),
);
},
),
const SizedBox(
height: 8.0,
),
buildCard(
'Recent Trends in Technology',
() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const TechNology(),
),
);
},
),
],
),
);
}
}
| 0
|
mirrored_repositories/Chrona
|
mirrored_repositories/Chrona/lib/topics.dart
|
import 'package:chrona_1/RealTimeDatabase/users_to_push.dart';
import 'package:chrona_1/RealTimeDatabase/users_to_push.dart' show User;
import 'package:chrona_1/SharedPreferences/shared_preferences.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grouped_buttons/grouped_buttons.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'Activities/main.dart';
class TopicRoute extends StatefulWidget {
@override
_TopicRouteState createState() => _TopicRouteState();
}
class _TopicRouteState extends State<TopicRoute> {
List<String> topic = new List();
//List<User> userDatabase = List();
// User user= new User(appState.user);
final FirebaseDatabase database = FirebaseDatabase.instance;
// final GlobalKey<FormState> formKey = GlobalKey<FormState>();
DatabaseReference databaseReference;
@override
void initState() {
super.initState();
databaseReference = database.reference().child("Users");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text("Topics of Interests"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: ListView(
children: <Widget>[
new Padding(padding: EdgeInsets.all(20.0)),
CheckboxGroup(
orientation: GroupedButtonsOrientation.VERTICAL,
margin: const EdgeInsets.only(left: 12.0),
labels: <String>[
"Politics",
"Technology",
"Global",
"Science",
"Sports",
"Business",
"Gaming",
"Entertainment",
"Automobile",
"Health",
],
onSelected: (List<String> checked){
topic=checked;
}
),
Padding(
padding: EdgeInsets.all(30.0),
),
Text(
"Click clear if you want to clear list or Submit to Save your interests",
style: TextStyle(fontSize: 20.0, fontStyle: FontStyle.italic),
),
RaisedButton(
onPressed: () {
topic.clear();
},
child: Text(
"CLEAR",
style: TextStyle(fontSize: 25.0),
),
),
RaisedButton(
onPressed: () => handleSubmit(context),
child: Text(
"SUBMIT",
style: TextStyle(fontSize: 25.0),
),
),
],
),
);
}
handleSubmit(BuildContext context) async {
if(topic.length==0)
{
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.red.shade500, Colors.orange.shade500],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Something Missing!!!',
message: 'You have not selected anything atleast choose one option',
duration: Duration(seconds: 3),
)..show(context);
}
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setInt(StaticState.user.email.toString(), 1);
String s=StaticState.user.email;
s=s.substring(0,s.indexOf("@"));
databaseReference.child(s).child("topicsofinterest").set({"toi":topic});
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => NewsMain()));
}
}
| 0
|
mirrored_repositories/Chrona
|
mirrored_repositories/Chrona/lib/main.dart
|
import 'package:flutter/material.dart';
import 'SignIn/app.dart';
import 'SignIn/state_widget.dart';
void main(){
StateWidget stateWidget = new StateWidget(child:new MyApp());
runApp(stateWidget);
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/RealTimeDatabase/users_to_push.dart
|
import 'package:chrona_1/UserInfo/state.dart';
import 'package:chrona_1/SignIn/state_widget.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
class User {
String key = "";
Map<dynamic, dynamic> answered;
Map<dynamic, dynamic> questioned;
Map<dynamic, dynamic> bookmark;
List<String> topicsOfInterest;
//User.topic(this.topicsOfInterest);
User(this.topicsOfInterest);
toJson() {
print("sddsf"+topicsOfInterest.toString());
return {
"emailId": StaticState.user.email,
"name": StaticState.user.displayName,
"topicsofinterest": topicsOfInterest
};
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/account.dart
|
import 'package:chrona_1/Activities/article.dart';
import 'package:chrona_1/Activities/home.dart';
import 'package:chrona_1/Activities/main.dart';
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/SignIn/auth.dart';
import 'package:chrona_1/SignIn/login.dart';
import 'package:chrona_1/SignIn/state_widget.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:chrona_1/news/web_view.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
class Account extends StatefulWidget {
@override
_AccountState createState() => _AccountState();
}
class _AccountState extends State<Account> {
GoogleSignInAccount googleAccount;
int selectedIndex = 3;
FirebaseDatabase firebaseDatabase = FirebaseDatabase.instance;
DatabaseReference databaseReferenceNews,
databaseReferenceBookmark,
databaseReferenceArticle;
String s;
final GoogleSignIn googleSignIn = new GoogleSignIn();
StateModel appState;
@override
void setState(VoidCallback fn) {
s = StaticState.user.email;
s = s.substring(0, s.indexOf("@"));
databaseReferenceNews = firebaseDatabase
.reference()
.child("Users")
.child(s.toString())
.child("News");
databaseReferenceArticle = firebaseDatabase.reference().child("Article");
databaseReferenceBookmark = firebaseDatabase
.reference()
.child("Users")
.child(s)
.child("bookmark")
.orderByChild("articleid");
}
@override
Widget build(BuildContext context) {
appState= StateWidget.of(context).state;
String s = StaticState.user.email;
s = s.substring(0, s.indexOf("@"));
return Scaffold(
appBar: AppBar(
title: new Text("Account"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
onPressed:()=> _signOut(),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(6.0),
),
Text(
"Liked article of user are ",
style: TextStyle(
fontSize: 19.0,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
color: Colors.blueAccent),
),
Padding(
padding: EdgeInsets.all(6.0),
),
new Flexible(
child: new FirebaseAnimatedList(
query: firebaseDatabase
.reference()
.child("Users")
.child(s)
.child("News")
.child("Likes"),
padding: new EdgeInsets.all(8.0),
reverse: false,
itemBuilder: (_, DataSnapshot snapshot,
Animation<double> animation, int x) {
return new Card(
child: Container(
height: 120.0,
width: 120.0,
child: Center(
child: ListTile(
title: Text(
'${snapshot.value["title"]}',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold),
),
leading: Container(
height: 100.0,
width: 100.0,
child: snapshot.value["urlToImage"] == null
? Image.asset(
'images/no_image_available.png',
height: 70,
width: 70,
)
: Image.network(
'${snapshot.value["urlToImage"]}',
height: 70,
width: 70,
),
),
onTap: () => _onTapItem(
context,
snapshot.value["url"].toString(),
snapshot.value["source"]),
),
),
),
);
}),
),
Padding(
padding: EdgeInsets.all(6.0),
),
Text(
"Disliked Items of user are",
style: TextStyle(
fontSize: 19.0,
fontWeight: FontWeight.bold,
color: Colors.redAccent),
),
Padding(
padding: EdgeInsets.all(6.0),
),
new Flexible(
child: new FirebaseAnimatedList(
query: firebaseDatabase
.reference()
.child("Users")
.child(s)
.child("News")
.child("Dislikes"),
padding: new EdgeInsets.all(8.0),
reverse: false,
itemBuilder: (_, DataSnapshot snapshot,
Animation<double> animation, int x) {
return new Card(
child: Container(
height: 80.0,
width: 120.0,
child: Center(
child: ListTile(
title: Text(
'${snapshot.value["title"]}',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold),
),
onTap: () => _onTapItem(
context,
snapshot.value["url"].toString(),
snapshot.value["source"]),
),
),
),
);
}),
),
Text(
"Bookmarked item of user are",
style: TextStyle(
fontSize: 19.0,
fontWeight: FontWeight.bold,
color: Colors.redAccent),
),
Padding(
padding: EdgeInsets.all(6.0),
),
new Flexible(
child: new FirebaseAnimatedList(
query: firebaseDatabase
.reference()
.child("Users")
.child(s)
.child("bookmark"),
padding: new EdgeInsets.all(8.0),
reverse: false,
itemBuilder: (_, DataSnapshot snapshot,
Animation<double> animation, int x) {
return ExpansionTile(
title: Text(
'${snapshot.value["header"]}',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold),
),
children: <Widget>[Text(
'${snapshot.value["body"]}',
style: TextStyle(fontSize: 14.0),
)],
);
}),
),
],
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home), title: new Text("Home")),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer), title: new Text("Q/A")),
BottomNavigationBarItem(
icon: Icon(Icons.description),
title: Text("Article"),
),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle),
title: new Text("Account"),
backgroundColor: Colors.black)
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => NewsMain()));
//selectedIndex=0;
}
if (value == 1) {
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => Question_Route()));
//selectedIndex=1;
}
if (value == 2) {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (context) => Article()));
}
}
void _onTapItem(
BuildContext context,
url,
source,
) {
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => WebView(url, source)));
}
Future <void> _signOut() async{
await FirebaseAuth.instance.signOut();
googleSignIn.signOut();
googleAccount = await getSignedInAccount(googleSignIn);
googleAccount=null;
appState.user=null;
appState.isLoading==false;
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>HomeScreen()));
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/update_question.dart
|
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'account.dart';
import 'article.dart';
import 'main.dart';
class UpdateQuestion extends StatefulWidget {
String qid, value;
UpdateQuestion(this.qid, this.value);
@override
_UpdateQuestionState createState() => _UpdateQuestionState(qid, value);
}
class _UpdateQuestionState extends State<UpdateQuestion> {
FirebaseDatabase firebaseDatabase;
String qid, value;
int selectedIndex = 1;
_UpdateQuestionState(this.qid, this.value);
DatabaseReference databaseReference;
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference = firebaseDatabase.reference().child("Question");
}
TextEditingController question = new TextEditingController();
@override
Widget build(BuildContext context) {
question.text=value;
return Scaffold(
appBar: AppBar(
title: new Text("Update Question"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
Card(
elevation: 5.0,
child: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
TextFormField(
readOnly: false,
autocorrect: true,
autofocus: false,
controller: question,
maxLength: 256,
maxLines: null,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Question",
hintText: 'Enter Question ',
prefixIcon: Icon(Icons.question_answer),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Padding(padding: EdgeInsets.all(10.0)),
RaisedButton(
onPressed: update,
child: Text("Submit"),)
],
),
),
],
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description), title: new Text("Article")),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
update() {
databaseReference.child(qid).child("question").set(question.text);
databaseReference.child(qid).child("verify").set(false);
databaseReference.child(qid).child("likeCount").set(0);
databaseReference.child(qid).child("dislikeCount").set(0);
databaseReference.child(qid).child("likes").set([]);
databaseReference.child(qid).child("dislikes").set([]);
Navigator.pop(context);
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 2) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Account()));
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/question.dart
|
import 'package:chrona_1/Activities/account.dart';
import 'package:chrona_1/Activities/add_question.dart';
import 'package:chrona_1/Activities/article.dart';
import 'package:chrona_1/Activities/main.dart';
import 'package:chrona_1/Activities/question_component.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class Question_Route extends StatefulWidget {
@override
_Question_RouteState createState() => _Question_RouteState();
}
class _Question_RouteState extends State<Question_Route> {
int selectedIndex = 1;
DatabaseReference databaseReference;
FirebaseDatabase firebaseDatabase;
Query query;
List<bool> liked,disliked;
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference = firebaseDatabase.reference().child("Question");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text("Question"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
new Flexible(
child: new FirebaseAnimatedList(
query: databaseReference.orderByChild("verify").equalTo(true),
padding: new EdgeInsets.all(8.0),
reverse: false,
itemBuilder: (_, DataSnapshot snapshot,
Animation<double> animation, int x) {
return QuestionComponent(snapshot: snapshot);
//Question component
}),
)
],
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
elevation: 5.0,
onPressed: addquestion,
backgroundColor: Colors.redAccent,
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description), title: new Text("Article")),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 2) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Account()));
}
}
void addquestion() {
Navigator.push(
context, MaterialPageRoute(builder: (context) => AddQuestion()));
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/add_question.dart
|
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'dart:convert';
import 'account.dart';
import 'main.dart';
class AddQuestion extends StatefulWidget {
@override
_AddQuestionState createState() => _AddQuestionState();
}
class _AddQuestionState extends State<AddQuestion> {
final FirebaseDatabase database = FirebaseDatabase.instance;
DatabaseReference databaseReferenceQues, databaseReferenceUser;
final TextEditingController questionText = new TextEditingController();
final TextEditingController tagcontroller = new TextEditingController();
int selectedIndex = 1;
@override
void initState() {
databaseReferenceQues = database.reference().child("Question");
databaseReferenceUser = database.reference().child("Users");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text("Add Question"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Container(
padding: EdgeInsets.all(6.0),
child: new ListView(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(padding: EdgeInsetsDirectional.only(start: 5.0)),
TextField(
autocorrect: true,
autofocus: true,
controller: questionText,
maxLength: 256,
maxLines: 6,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Question us anything!!!",
hintText: 'Write question here ',
prefixIcon: Icon(Icons.question_answer),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
))),
Padding(
padding: EdgeInsetsDirectional.only(top: 10.0),
),
TextField(
autocorrect: true,
autofocus: true,
controller: tagcontroller,
maxLength: 256,
maxLines: null,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Tags",
hintText: 'Enter Tags ',
prefixIcon: Icon(Icons.grade),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
))),
Padding(
padding: EdgeInsetsDirectional.only(top: 10.0),
),
RaisedButton(
onPressed: () => submit(context),
child: Text("Submit"),
elevation: 5.0,
)
],
),
],
),
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home), title: new Text("Home")),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer), title: new Text("Q/A")),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 1) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Question_Route()));
}
if (value == 2) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Account()));
//selectedIndex=2;
}
}
void submit(BuildContext context) {
if (questionText.text.isEmpty || tagcontroller.text.isEmpty) {
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.amber.shade500, Colors.orange.shade500],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Something Missing!!!',
message: 'Check whether above two fields are filled or not.',
duration: Duration(seconds: 4),
)..show(context);
} else {
List<String> tags = tagcontroller.text.split(";");
var firstChunk = utf8.encode(questionText.text);
var secondChunk = utf8.encode(tagcontroller.text);
var output = new AccumulatorSink<Digest>();
var input = sha1.startChunkedConversion(output);
input.add(firstChunk);
input.add(secondChunk); // call `add` for every chunk of input data
input.close();
var digest = output.events.single;
databaseReferenceQues
.child(digest.toString())
.once()
.then((DataSnapshot data) {
if (data.value != null) {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("This Question already exists !!"),
));
} else {
databaseReferenceQues.child(digest.toString()).set({
"question": questionText.text,
"tags": tags,
"verify": false,
"user": StaticState.user.email.toString(),
"username": StaticState.user.displayName.toString(),
"likes": [],
"likeCount":0,
"dislikes": [],
"dislikeCount":0,
});
String s = StaticState.user.email;
s = s.substring(0, s.indexOf("@"));
databaseReferenceUser
.child(s)
.child("question")
.push()
.set({"qid": digest.toString(), "verify": false});
Navigator.pop(context);
}
});
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/answer.dart
|
import 'package:chrona_1/Activities/add_answer.dart';
import 'package:chrona_1/Activities/answer_component.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flutter/material.dart';
import 'account.dart';
import 'article.dart';
import 'main.dart';
class Answer extends StatefulWidget {
String Id;
String KEY;
Answer(this.Id, this.KEY);
@override
_AnswerState createState() => _AnswerState(Id, KEY);
}
class _AnswerState extends State<Answer> {
String Ques;
String KEY;
_AnswerState(this.Ques, this.KEY);
int selectedIndex = 1;
DatabaseReference databaseReference;
FirebaseDatabase firebaseDatabase;
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference =
firebaseDatabase.reference().child("Question").child(KEY);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text("Answer"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(8.0),
),
TextFormField(
readOnly: true,
autocorrect: true,
autofocus: false,
initialValue: Ques,
maxLength: 256,
maxLines: null,
style:
TextStyle(fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Question",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
new Flexible(
child: new FirebaseAnimatedList(
query: databaseReference.child("Answer"),
padding: new EdgeInsets.all(8.0),
reverse: false,
itemBuilder: (_, DataSnapshot snapshot,
Animation<double> animation, int x) {
// tags.text=snapshot.value["tags"];
//print(snapshot.value);
return AnswerComponent(
snapshot: snapshot, questionKey: KEY);
}),
)
],
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
elevation: 5.0,
onPressed: () => addanswer(Ques, KEY),
backgroundColor: Colors.redAccent,
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description), title: new Text("Article")),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 2) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Account()));
}
}
void addanswer(String id, String key) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => AddAnswer(id, key)));
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/update_article.dart
|
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'account.dart';
import 'article.dart';
import 'main.dart';
class UpdateArticle extends StatefulWidget {
String KEY,head,body;
UpdateArticle(this.KEY, this.head, this.body);
@override
_UpdateArticleState createState() => _UpdateArticleState(KEY,head,body);
}
class _UpdateArticleState extends State<UpdateArticle> {
int selectedIndex=2;
String KEY,head,body;
_UpdateArticleState(this.KEY, this.head, this.body);
FirebaseDatabase firebaseDatabase;
DatabaseReference databaseReference;
TextEditingController header= TextEditingController();
TextEditingController BODY=TextEditingController();
@override
void initState() {
firebaseDatabase=FirebaseDatabase.instance;
databaseReference=firebaseDatabase.reference().child("Article");
}
@override
Widget build(BuildContext context) {
header.text=head;
BODY.text=body;
return Scaffold(
appBar: AppBar(
title: new Text("Update Article"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
Card(
elevation: 5.0,
child: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
TextFormField(
readOnly: false,
autocorrect: true,
autofocus: false,
controller: header,
maxLength: 256,
maxLines: null,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Header",
prefixIcon: Icon(Icons.view_headline),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Padding(padding: EdgeInsets.all(10.0)),
TextFormField(
readOnly: false,
autocorrect: true,
autofocus: false,
controller: BODY,
maxLength: 512,
maxLines: null,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Body",
prefixIcon: Icon(Icons.description),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
RaisedButton(
onPressed: update,
child: Text("Submit"),)
],
),
),
],
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description), title: new Text("Article"),backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
update() {
databaseReference.child(KEY).child("header").set(header.text);
databaseReference.child(KEY).child("body").set(BODY.text);
databaseReference.child(KEY).child("verify").set(false);
databaseReference.child(KEY).child("likeCount").set(0);
databaseReference.child(KEY).child("dislikeCount").set(0);
databaseReference.child(KEY).child("likes").set([]);
databaseReference.child(KEY).child("dislikes").set([]);
Navigator.pop(context);
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if(value==1)
{
Navigator.push(context, MaterialPageRoute(builder: (context)=>Question_Route()));
}
if (value == 2) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Account()));
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/add_article.dart
|
import 'dart:convert';
import 'package:chrona_1/Activities/article.dart';
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'account.dart';
import 'main.dart';
class AddArticle extends StatefulWidget {
@override
_AddArticleState createState() => _AddArticleState();
}
class _AddArticleState extends State<AddArticle> {
FirebaseDatabase firebaseDatabase = FirebaseDatabase.instance;
DatabaseReference databaseReferenceArticle, databaseReferenceUser;
@override
void initState() {
databaseReferenceArticle = firebaseDatabase.reference().child("Article");
databaseReferenceUser = firebaseDatabase.reference().child("Users");
}
final TextEditingController headerController = new TextEditingController();
final TextEditingController bodyController = new TextEditingController();
int selectedIndex = 2;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text("Add Article"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Container(
padding: EdgeInsets.all(6.0),
child: new ListView(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(padding: EdgeInsetsDirectional.only(start: 5.0)),
TextField(
autocorrect: true,
autofocus: true,
controller: headerController,
maxLength: 256,
maxLines: 8,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Header you want to display!!!",
hintText: 'Write Intutive Header ',
prefixIcon: Icon(Icons.view_headline),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
))),
Padding(
padding: EdgeInsetsDirectional.only(top: 10.0),
),
TextField(
autocorrect: true,
autofocus: true,
controller: bodyController,
maxLength: 1024,
maxLines: 18,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Body you want to show",
hintText: 'Write your Article here',
prefixIcon: Icon(Icons.grade),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
))),
Padding(
padding: EdgeInsetsDirectional.only(top: 10.0),
),
RaisedButton(
onPressed: () => submit(context),
child: Text("Submit"),
elevation: 5.0,
)
],
),
],
),
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description),
title: new Text("Article"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void submit(BuildContext context) {
if (headerController.text.isEmpty || headerController.text.isEmpty) {
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.amber.shade500, Colors.orange.shade500],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Something Missing!!!',
message: 'Check whether above two fields are filled or not.',
duration: Duration(seconds: 4),
)..show(context);
} else {
var firstChunk = utf8.encode(headerController.text);
var secondChunk = utf8.encode(bodyController.text);
var output = new AccumulatorSink<Digest>();
var input = sha1.startChunkedConversion(output);
input.add(firstChunk);
input.add(secondChunk); // call `add` for every chunk of input data
input.close();
var digest = output.events.single;
databaseReferenceArticle
.child(digest.toString())
.once()
.then((DataSnapshot data) {
if (data.value != null) {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("This Question already exists !!"),
));
} else {
var firstChunk = utf8.encode(headerController.text);
var secondChunk = utf8.encode(bodyController.text);
var output = new AccumulatorSink<Digest>();
var input = sha1.startChunkedConversion(output);
input.add(firstChunk);
input.add(secondChunk); // call `add` for every chunk of input data
input.close();
var digest = output.events.single;
databaseReferenceArticle.child(digest.toString()).set({
"header": headerController.text,
"body": bodyController.text,
"verify": false,
"user": StaticState.user.email.toString(),
"username": StaticState.user.displayName.toString(),
"likes": [],
"likeCount":0,
"dislikes": [],
"dislikeCount":0,
});
String s = StaticState.user.email;
s = s.substring(0, s.indexOf("@"));
databaseReferenceUser
.child(s)
.child("article")
.push()
.set({"qid": digest.toString(), "verify": false});
Navigator.pop(context);
}
});
}
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 1) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Question_Route()));
}
if (value == 2) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Account()));
//selectedIndex=2;
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/update_answer.dart
|
import 'package:chrona_1/Activities/answer.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'account.dart';
import 'article.dart';
import 'main.dart';
class UpdateAnswer extends StatefulWidget {
String ansId,ans,qid;
UpdateAnswer(this.qid,this.ansId, this.ans);
@override
_UpdateAnswerState createState() => _UpdateAnswerState(qid,ansId,ans);
}
class _UpdateAnswerState extends State<UpdateAnswer> {
FirebaseDatabase firebaseDatabase;
String ansId,ans,qid;
int selectedIndex = 1;
_UpdateAnswerState(this.qid,this.ansId, this.ans);
DatabaseReference databaseReference;
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference = firebaseDatabase.reference().child("Question").child(qid).child("Answer");
}
TextEditingController answer = new TextEditingController();
@override
Widget build(BuildContext context) {
answer.text=ans;
return Scaffold(
appBar: AppBar(
title: new Text("Update Answer"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
Card(
elevation: 5.0,
child: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
TextFormField(
readOnly: false,
autocorrect: true,
autofocus: false,
controller: answer,
maxLength: 256,
maxLines: null,
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Answer",
prefixIcon: Icon(Icons.question_answer),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Padding(padding: EdgeInsets.all(10.0)),
RaisedButton(
onPressed: update,
child: Text("Submit"),)
],
),
),
],
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description), title: new Text("Article")),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
update() {
databaseReference.child(ansId).child("answer").set(answer.text);
databaseReference.child(ansId).child("likeCount").set(0);
databaseReference.child(ansId).child("dislikeCount").set(0);
databaseReference.child(ansId).child("likes").set([]);
databaseReference.child(ansId).child("dislikes").set([]);
Navigator.pop(context);
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 2) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => Account()));
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/question_component.dart
|
import 'package:chrona_1/Activities/update_question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:flushbar/flushbar.dart';
import 'answer.dart';
class QuestionComponent extends StatefulWidget {
final DataSnapshot snapshot;
const QuestionComponent({Key key, this.snapshot}) : super(key: key);
@override
_QuestionComponentState createState() => _QuestionComponentState();
}
class _QuestionComponentState extends State<QuestionComponent> {
DatabaseReference databaseReference;
FirebaseDatabase firebaseDatabase;
bool isLiked, isDisliked, isLoading;
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference = firebaseDatabase.reference().child("Question");
isLiked = false;
isDisliked = false;
isLoading = true;
super.initState();
}
@override
Widget build(BuildContext context) {
DataSnapshot snapshot = widget.snapshot;
loadLikeData(snapshot.key);
return Slidable(
actionPane: SlidableDrawerActionPane(),
actionExtentRatio: 0.20,
child: new Card(
elevation: 5.0,
child: isLoading
? Column(children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
Center(child: CircularProgressIndicator()),
Padding(padding: EdgeInsets.all(5.0)),
])
: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
TextFormField(
readOnly: true,
autocorrect: true,
autofocus: false,
initialValue: snapshot.value["question"],
maxLength: 256,
maxLines: 4,
style: TextStyle(
fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Question",
hintText: 'Enter Question ',
prefixIcon: Icon(Icons.question_answer),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Text(
"Questioner is ${snapshot.value["username"]}",
textAlign: TextAlign.left,
),
Padding(padding: EdgeInsets.all(4.0)),
TextFormField(
readOnly: true,
autocorrect: true,
autofocus: false,
initialValue: snapshot.value["tags"].toString(),
maxLength: 256,
maxLines: 4,
style: TextStyle(
fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Tags",
hintText: 'Enter Tags ',
prefixIcon: Icon(Icons.grade),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Row(
children: <Widget>[
Icon(
Icons.thumb_up,
color: isLiked ? Colors.blueAccent : Colors.black45,
),
Text(
snapshot.value["likeCount"].toString(),
style: TextStyle(color: Colors.indigo),
),
Padding(padding: EdgeInsetsDirectional.only(start: 5.0)),
Icon(
Icons.thumb_down,
color: isDisliked ? Colors.redAccent : Colors.black45,
),
Text(
" " + snapshot.value["dislikeCount"].toString(),
style: TextStyle(color: Colors.red),
),
Padding(padding: EdgeInsets.only(left: 50.0)),
RaisedButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Answer(
snapshot.value["question"], snapshot.key))),
child: Text("View"),
),
Padding(padding: EdgeInsets.only(left: 50.0)),
RaisedButton(
child: Text("UPDATE"),
onPressed: snapshot.value["user"].toString() ==
StaticState.user.email.toString()
? () => update(snapshot.key,
snapshot.value["question"].toString())
: null,
),
],
)
],
),
),
actions: <Widget>[
IconSlideAction(
caption: 'Delete',
color: Colors.red,
icon: Icons.delete,
onTap: ()=>checkForDelete(context, snapshot.key, snapshot.value["user"])
)
],
secondaryActions: <Widget>[
IconSlideAction(
caption: 'Like',
color: Colors.blue,
icon: Icons.check,
onTap: () => Like(snapshot.key),
),
IconSlideAction(
caption: 'Dislike',
color: Colors.red,
icon: Icons.clear,
onTap: () => Dislike(snapshot.key),
),
],
);
}
void loadLikeData(String key) {
bool liked, disliked;
databaseReference
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((snapshot) {
if (snapshot.value != null && snapshot.value["flag"]) {
liked = true;
} else {
liked = false;
}
databaseReference
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((snapshot) {
if (snapshot.value != null && snapshot.value["flag"]) {
disliked = true;
} else {
disliked = false;
}
setState(() {
isLiked = liked;
isDisliked = disliked;
isLoading = false;
});
});
});
}
Like(String key) {
bool flag = false;
databaseReference
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value == null) {
flag = true;
databaseReference
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": true});
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReference.child(key).child("likeCount").set(likes + 1);
});
} else {
flag = snapshot.value["flag"];
if (flag == true) {
flag = false;
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReference.child(key).child("likeCount").set(likes - 1);
});
} else {
flag = true;
print("%%");
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReference.child(key).child("likeCount").set(likes + 1);
});
}
databaseReference
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag});
}
checkDislike(flag, key);
});
}
checkDislike(bool flag, String key) {
if (flag == true) {
databaseReference
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value != null) {
bool flag1 = snapshot.value["flag"];
if (flag1 == true) {
flag1 = false;
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReference
.child(key)
.child("dislikeCount")
.set(dislikes - 1);
});
}
databaseReference
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag1});
}
});
}
}
Dislike(String key) {
bool flag;
databaseReference
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value == null) {
flag = true;
databaseReference
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": true});
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReference.child(key).child("dislikeCount").set(dislikes + 1);
});
} else {
flag = snapshot.value["flag"];
if (flag == true) {
flag = false;
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReference
.child(key)
.child("dislikeCount")
.set(dislikes - 1);
});
} else {
flag = true;
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReference
.child(key)
.child("dislikeCount")
.set(dislikes + 1);
});
}
databaseReference
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag});
}
checkLike(flag, key);
});
}
checkLike(bool flag, String key) {
if (flag == true) {
databaseReference
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value != null) {
bool flag1 = snapshot.value["flag"];
if (flag1 == true) {
flag1 = false;
databaseReference.child(key).once().then((DataSnapshot snapshot) {
int dislikes = snapshot.value["likeCount"];
databaseReference.child(key).child("likeCount").set(dislikes - 1);
});
}
databaseReference
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag1});
}
});
}
}
checkForDelete(BuildContext context, String key, String user) {
if (user == StaticState.user.email.toString()) {
databaseReference.child(key).remove();
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.green, Colors.lightGreen],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Successful!',
message: 'Your Question has been deleted successfully!!!',
duration: Duration(seconds: 4),
)..show(context);
} else {
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.deepOrange, Colors.deepOrangeAccent],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Failure!',
message: 'You cannot delete other user Question',
duration: Duration(seconds: 4),
)..show(context);
}
}
update(String key, value) {
Navigator.push(context,
MaterialPageRoute(builder: (context) => UpdateQuestion(key, value)));
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/article_component.dart
|
import 'package:chrona_1/Activities/update_article.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class ArticleComponent extends StatefulWidget {
final DataSnapshot snapshot;
const ArticleComponent({Key key, this.snapshot}) : super(key: key);
@override
_ArticleComponentState createState() => _ArticleComponentState();
}
class _ArticleComponentState extends State<ArticleComponent> {
DatabaseReference databaseReferenceArticle, databaseReferenceUser;
FirebaseDatabase firebaseDatabase;
bool isLiked, isDisliked, isLoading;
static bool OnChanged;
@override
void initState() {
OnChanged = false;
firebaseDatabase = FirebaseDatabase.instance;
databaseReferenceArticle = firebaseDatabase.reference().child("Article");
databaseReferenceUser = firebaseDatabase.reference().child("Users");
isLiked = false;
isDisliked = false;
isLoading = true;
super.initState();
}
TextEditingController headerController = new TextEditingController();
TextEditingController bodyController = new TextEditingController();
@override
Widget build(BuildContext context) {
DataSnapshot snapshot = widget.snapshot;
loadLikeData(snapshot.key);
headerController.text = snapshot.value["header"];
bodyController.text = snapshot.value["body"];
return Slidable(
actionPane: SlidableDrawerActionPane(),
actionExtentRatio: 0.20,
child: new Card(
elevation: 5.0,
child: isLoading
? Column(children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
Center(child: CircularProgressIndicator()),
Padding(padding: EdgeInsets.all(5.0)),
])
: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
TextFormField(
readOnly: snapshot.value["user"].toString() ==
StaticState.user.email.toString()
? false
: true,
//initialValue: snapshot.value['header'].toString(),
onEditingComplete: () => OnChanged = true,
autocorrect: true,
autofocus: false,
initialValue: snapshot.value["header"],
maxLength: 128,
maxLines: 4,
style: TextStyle(
fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Heading",
hintText: 'Enter Heading ',
prefixIcon: Icon(Icons.view_headline),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Text(
"Questioner is ${snapshot.value["username"]}",
textAlign: TextAlign.left,
),
Padding(padding: EdgeInsets.all(4.0)),
TextFormField(
readOnly: snapshot.value["user"].toString() ==
StaticState.user.email.toString()
? false
: true,
// initialValue: snapshot.value['body'].toString(),
onEditingComplete: () => OnChanged = true,
autocorrect: true,
autofocus: false,
initialValue: snapshot.value["body"],
maxLength: 1024,
maxLines: null,
style: TextStyle(
fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Body",
hintText: 'Enter Body ',
prefixIcon: Icon(Icons.description),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Row(
children: <Widget>[
Icon(
Icons.thumb_up,
color: isLiked ? Colors.blueAccent : Colors.black45,
),
Text(
" " + snapshot.value["likeCount"].toString(),
style: TextStyle(color: Colors.indigo),
),
Padding(padding: EdgeInsetsDirectional.only(start: 5.0)),
Icon(
Icons.thumb_down,
color: isDisliked ? Colors.redAccent : Colors.black45,
),
Text(
" " + snapshot.value["dislikeCount"].toString(),
style: TextStyle(color: Colors.red),
),
Padding(padding: EdgeInsets.only(left: 190.0)),
RaisedButton(
child: Text("UPDATE"),
onPressed: snapshot.value["user"].toString() ==
StaticState.user.email.toString()
? () => update(
snapshot.key,
snapshot.value["header"],
snapshot.value["body"])
: null,
),
],
)
],
),
),
actions: <Widget>[
IconSlideAction(
caption: 'Bookmark',
color: Colors.blue,
icon: Icons.bookmark,
onTap: () =>
Bookmark(snapshot.value["header"], snapshot.value["body"]),
),
IconSlideAction(
caption: 'Delete',
color: Colors.red,
icon: Icons.delete,
onTap: () =>
checkForDelete(context, snapshot.key, snapshot.value["user"]),
)
],
secondaryActions: <Widget>[
IconSlideAction(
caption: 'Like',
color: Colors.blue,
icon: Icons.check,
onTap: () => Like(snapshot.key),
),
IconSlideAction(
caption: 'Dislike',
color: Colors.red,
icon: Icons.clear,
onTap: () => Dislike(snapshot.key),
),
],
);
}
void loadLikeData(String key) {
bool liked, disliked;
databaseReferenceArticle
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((snapshot) {
if (snapshot.value != null && snapshot.value["flag"]) {
liked = true;
} else {
liked = false;
}
databaseReferenceArticle
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((snapshot) {
if (snapshot.value != null && snapshot.value["flag"]) {
disliked = true;
} else {
disliked = false;
}
setState(() {
isLiked = liked;
isDisliked = disliked;
isLoading = false;
});
});
});
}
Like(String key) {
bool flag = false;
databaseReferenceArticle
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value == null) {
flag = true;
databaseReferenceArticle
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": true});
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReferenceArticle.child(key).child("likeCount").set(likes + 1);
});
} else {
flag = snapshot.value["flag"];
if (flag == true) {
flag = false;
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReferenceArticle
.child(key)
.child("likeCount")
.set(likes - 1);
});
} else {
flag = true;
print("%%");
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReferenceArticle
.child(key)
.child("likeCount")
.set(likes + 1);
});
}
databaseReferenceArticle
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag});
}
checkDislike(flag, key);
});
}
checkDislike(bool flag, String key) {
if (flag == true) {
databaseReferenceArticle
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value != null) {
bool flag1 = snapshot.value["flag"];
if (flag1 == true) {
flag1 = false;
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceArticle
.child(key)
.child("dislikeCount")
.set(dislikes - 1);
});
}
databaseReferenceArticle
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag1});
}
});
}
}
Dislike(String key) {
bool flag;
databaseReferenceArticle
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value == null) {
flag = true;
databaseReferenceArticle
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": true});
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceArticle
.child(key)
.child("dislikeCount")
.set(dislikes + 1);
});
} else {
flag = snapshot.value["flag"];
if (flag == true) {
flag = false;
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceArticle
.child(key)
.child("dislikeCount")
.set(dislikes - 1);
});
} else {
flag = true;
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceArticle
.child(key)
.child("dislikeCount")
.set(dislikes + 1);
});
}
databaseReferenceArticle
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag});
}
checkLike(flag, key);
});
}
checkLike(bool flag, String key) {
if (flag == true) {
databaseReferenceArticle
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value != null) {
bool flag1 = snapshot.value["flag"];
if (flag1 == true) {
flag1 = false;
databaseReferenceArticle
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["likeCount"];
databaseReferenceArticle
.child(key)
.child("likeCount")
.set(dislikes - 1);
});
}
databaseReferenceArticle
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag1});
}
});
}
}
checkForDelete(BuildContext context, String key, String user) {
if (user == StaticState.user.email.toString()) {
databaseReferenceArticle.child(key).remove();
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.green, Colors.lightGreen],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Successful!',
message: 'Your Article has been deleted successfully!!!',
duration: Duration(seconds: 4),
)..show(context);
} else {
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.deepOrange, Colors.deepOrangeAccent],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Failure!',
message: 'You cannot delete other user Article',
duration: Duration(seconds: 4),
)..show(context);
}
}
update(String key, head, body) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => UpdateArticle(key, head, body)));
}
Bookmark(String key, value) {
String s = StaticState.user.email;
s = s.substring(0, s.indexOf("@"));
databaseReferenceUser
.child(s)
.child("bookmark")
.push()
.set({"header": key, "body": value});
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/main.dart
|
import 'dart:collection';
import 'package:chrona_1/Activities/account.dart';
import 'package:chrona_1/Activities/article.dart';
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import '../news/categories.dart';
import '../news/news_list.dart';
class NewsMain extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
debugShowCheckedModeBanner: false,
title: 'chrona',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
darkTheme: ThemeData.dark(),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
int selectedIndex=0;
List<Categories> categoriesList;
DatabaseReference databaseReference;
FirebaseDatabase firebaseDatabase;
HashMap<String,int> selectedItems=new HashMap();
bool loading=true;
@override
void initState() {
super.initState();
firebaseDatabase = FirebaseDatabase.instance;
databaseReference=firebaseDatabase.reference().child("Users");
categoriesList = new List<Categories>();
}
Future<List<Categories>> loadCategories() async{
var categories = <Categories>[
//adding all the categories of news in the list
new Categories('images/top_news.png', "Top Headlines", "top_news"),
new Categories('images/global_news.png', "Global", "global"),
new Categories('images/health_news.png', "Health", "health"),
new Categories('images/entertainment_news.png', "Entertainment", "entertainment"),
new Categories('images/sports_news.png', "Sports", "sports"),
new Categories('images/business_news.png', "Business", "business"),
new Categories('images/tech_news.png', "Technology", "technology"),
new Categories('images/science_news.png', "Science", "science"),
new Categories('images/politics_news.png', "Politics", "politics"),
new Categories('images/automobile_news.png', "Automobile", "automobiles"),
new Categories('images/gaming_news.png', "Gaming", "gaming")
];
String s=StaticState.user.email;
s=s.substring(0,s.indexOf("@"));
// databaseReference.child(s).child("topicsofinterest").child("toi").once().then((DataSnapshot snapshot) {
// List<dynamic> values=snapshot.value;
// print(values);
// values.forEach((value) {
// selectedItems[value]=1;
// });
// });
DataSnapshot snapshot=await databaseReference.child(s).child("topicsofinterest").child("toi").once();
List<dynamic> values=snapshot.value;
values.forEach((element) {
selectedItems[element]=1;
});
List<Categories> selectedCategories=[];
selectedCategories.add(categories[0]);
categories.forEach((element) {
if(selectedItems.containsKey(element.title))
selectedCategories.add(element);
});
return selectedCategories;
}
@override
Widget build(BuildContext context) {
final title = 'Chrona';
loadCategories().then((value) {
setState(() {
categoriesList=value;
loading=false;
});
});
return Scaffold(
appBar: AppBar(
title: Text(title),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body:loading?Center(child: CircularProgressIndicator()):GridView.count(
// Create a grid with 2 columns. If you change the scrollDirection to
// horizontal, this would produce 2 rows.
crossAxisCount: 2,
// Generate 100 Widgets that display their index in the List
children: List.generate(categoriesList.length, (index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: RaisedButton(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0)),
child: Column(
children: <Widget>[
Image(
image: AssetImage(categoriesList[index].image),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
categoriesList[index].title,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
],
),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => NewsListPage(
categoriesList[index].title,
categoriesList[index].newsType)));
},
),
);
}),
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),backgroundColor: Colors.black,
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A")
),
BottomNavigationBarItem(
icon: Icon(Icons.description),
title: Text("Article"),
),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle),
title: new Text("Account")
)
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
)
);
}
void _ontappeditem(int value) {
if(value==1)
{
Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (context)=>Question_Route()));
//selectedIndex=1;
}
if(value==2)
{
Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context)=>Article()));
}
if(value==3)
{
Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (context)=>Account()));
// selectedIndex=2;
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/answer_component.dart
|
import 'package:chrona_1/Activities/update_answer.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class AnswerComponent extends StatefulWidget {
final DataSnapshot snapshot;
final String questionKey;
const AnswerComponent({Key key, this.snapshot, this.questionKey})
: super(key: key);
@override
_AnswerComponentState createState() => _AnswerComponentState();
}
class _AnswerComponentState extends State<AnswerComponent> {
DatabaseReference databaseReference, databaseReferenceAnswer;
FirebaseDatabase firebaseDatabase;
bool isLiked, isDisliked, isLoading;
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference = firebaseDatabase
.reference()
.child("Question")
.child(widget.questionKey);
databaseReferenceAnswer = databaseReference.child("Answer");
isLiked = false;
isDisliked = false;
isLoading = true;
super.initState();
}
@override
Widget build(BuildContext context) {
DataSnapshot snapshot = widget.snapshot;
loadLikeData(snapshot.key);
TextEditingController answer = new TextEditingController();
answer.text = snapshot.value["answer"];
return Slidable(
actionPane: SlidableDrawerActionPane(),
actionExtentRatio: 0.20,
child: new Card(
elevation: 5.0,
child: isLoading
? Column(children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
Center(child: CircularProgressIndicator()),
Padding(padding: EdgeInsets.all(5.0)),
])
: Column(
children: <Widget>[
Padding(padding: EdgeInsets.all(5.0)),
TextFormField(
readOnly: true,
autocorrect: true,
autofocus: false,
controller: answer,
//initialValue: snapshot.value["answer"],
maxLength: 256,
maxLines: null,
style: TextStyle(
fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Answer",
hintText: 'Enter Answer ',
prefixIcon: Icon(Icons.question_answer),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Text(
"Answer is uploaded by ${snapshot.value["username"]}",
textAlign: TextAlign.left,
),
Padding(padding: EdgeInsets.all(4.0)),
Row(
children: <Widget>[
Icon(
Icons.thumb_up,
color: isLiked ? Colors.blueAccent : Colors.black45,
),
Text(
" " + snapshot.value["likeCount"].toString(),
style: TextStyle(color: Colors.indigo),
),
Padding(padding: EdgeInsetsDirectional.only(start: 5.0)),
Icon(
Icons.thumb_down,
color: isDisliked ? Colors.redAccent : Colors.black45,
),
Text(
" " + snapshot.value["dislikeCount"].toString(),
style: TextStyle(color: Colors.red),
),
Padding(padding: EdgeInsets.only(left: 50.0)),
Padding(padding: EdgeInsets.only(left: 50.0)),
RaisedButton(
child: Text("UPDATE"),
onPressed: snapshot.value["user"].toString() ==
StaticState.user.email.toString()
? () => update(widget.questionKey, snapshot.key,
snapshot.value["answer"])
: null,
),
],
)
],
),
),
actions: <Widget>[
IconSlideAction(
caption: 'Delete',
color: Colors.red,
icon: Icons.delete,
onTap: () =>
checkForDelete(context, snapshot.key, snapshot.value["user"]),
)
],
secondaryActions: <Widget>[
IconSlideAction(
caption: 'Like',
color: Colors.blue,
icon: Icons.check,
onTap: () => Like(snapshot.key),
),
IconSlideAction(
caption: 'Dislike',
color: Colors.red,
icon: Icons.clear,
onTap: () => Dislike(snapshot.key),
),
],
);
}
void loadLikeData(String key) {
bool liked, disliked;
databaseReferenceAnswer
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((snapshot) {
if (snapshot.value != null && snapshot.value["flag"]) {
liked = true;
} else {
liked = false;
}
databaseReferenceAnswer
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((snapshot) {
if (snapshot.value != null && snapshot.value["flag"]) {
disliked = true;
} else {
disliked = false;
}
setState(() {
isLiked = liked;
isDisliked = disliked;
isLoading = false;
});
});
});
}
Like(String key) {
bool flag = false;
databaseReferenceAnswer
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value == null) {
flag = true;
databaseReferenceAnswer
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": true});
databaseReferenceAnswer.child(key).once().then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReferenceAnswer.child(key).child("likeCount").set(likes + 1);
});
} else {
flag = snapshot.value["flag"];
if (flag == true) {
flag = false;
databaseReferenceAnswer
.child(key)
.once()
.then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReferenceAnswer
.child(key)
.child("likeCount")
.set(likes - 1);
});
} else {
flag = true;
print("%%");
databaseReferenceAnswer
.child(key)
.once()
.then((DataSnapshot snapshot) {
int likes = snapshot.value["likeCount"];
databaseReferenceAnswer
.child(key)
.child("likeCount")
.set(likes + 1);
});
}
databaseReferenceAnswer
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag});
}
checkDislike(flag, key);
});
}
checkDislike(bool flag, String key) {
if (flag == true) {
databaseReferenceAnswer
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value != null) {
bool flag1 = snapshot.value["flag"];
if (flag1 == true) {
flag1 = false;
databaseReferenceAnswer
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceAnswer
.child(key)
.child("dislikeCount")
.set(dislikes - 1);
});
}
databaseReferenceAnswer
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag1});
}
});
}
}
Dislike(String key) {
bool flag;
databaseReferenceAnswer
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value == null) {
flag = true;
databaseReferenceAnswer
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": true});
databaseReferenceAnswer.child(key).once().then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceAnswer
.child(key)
.child("dislikeCount")
.set(dislikes + 1);
});
} else {
flag = snapshot.value["flag"];
if (flag == true) {
flag = false;
databaseReferenceAnswer
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceAnswer
.child(key)
.child("dislikeCount")
.set(dislikes - 1);
});
} else {
flag = true;
databaseReferenceAnswer
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["dislikeCount"];
databaseReferenceAnswer
.child(key)
.child("dislikeCount")
.set(dislikes + 1);
});
}
databaseReferenceAnswer
.child(key)
.child("dislikes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag});
}
checkLike(flag, key);
});
}
checkLike(bool flag, String key) {
if (flag == true) {
databaseReferenceAnswer
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.once()
.then((DataSnapshot snapshot) {
if (snapshot.value != null) {
bool flag1 = snapshot.value["flag"];
if (flag1 == true) {
flag1 = false;
databaseReferenceAnswer
.child(key)
.once()
.then((DataSnapshot snapshot) {
int dislikes = snapshot.value["likeCount"];
databaseReferenceAnswer
.child(key)
.child("likeCount")
.set(dislikes - 1);
});
}
databaseReferenceAnswer
.child(key)
.child("likes")
.child(StaticState.user.email
.substring(0, StaticState.user.email.indexOf("@")))
.set({"flag": flag1});
}
});
}
}
checkForDelete(BuildContext context, String key, String user) {
if (user == StaticState.user.email.toString()) {
databaseReference.child("Answer").child(key).remove();
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.green, Colors.lightGreen],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Successful!',
message: 'Your Answer has been deleted successfully!!!',
duration: Duration(seconds: 4),
)..show(context);
} else {
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.deepOrange, Colors.deepOrangeAccent],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Failure!',
message: 'You cannot delete other user Answer',
duration: Duration(seconds: 4),
)..show(context);
}
}
update(String qid, ansId, ans) {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => UpdateAnswer(qid, ansId, ans)));
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/home.dart
|
import 'package:chrona_1/Activities/main.dart';
import 'package:chrona_1/SignIn/app.dart';
import 'package:chrona_1/main.dart';
import 'package:chrona_1/topics.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../UserInfo/state.dart';
import '../SignIn/state_widget.dart';
import '../SignIn/login.dart';
import '../topics.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:firebase_auth/firebase_auth.dart';
class HomeScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => new HomeScreenState();
}
class HomeScreenState extends State<HomeScreen> {
StateModel appState;
Widget _buildStories({Widget body}) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black87,
title: Text('Chrona'),
),
body: Container(
child: Center(
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Container(
alignment: Alignment.center,
padding: EdgeInsets.all(30.0),
height: 150.0,
width: 150.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(appState.user.photoUrl.toString()),
),
)),
new Text(
'Hello, ' '${appState.user.displayName}' '!',
textAlign: TextAlign.center,
style: TextStyle( fontSize: 25),
),
new Padding(padding: EdgeInsets.all(10.0)),
new Text(
"Welcome To Our Learning App",
style: new TextStyle(fontSize: 20.0),
), new Padding(padding: EdgeInsets.all(10.0)),
new RaisedButton(
onPressed: check,
child: new Text(
"Lets Get Started",
style:
new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
),
), new Padding(padding: EdgeInsets.all(10.0)),
new RaisedButton(
onPressed: topic,
child: new Text(
"Change topic of interest",
style:
new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
),
),
new Padding(padding: EdgeInsets.all(10.0)),
new RaisedButton(
onPressed: signOut,
child: new Text(
"Sign Out",
style:new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
)
)
],
)),
),
);
}
Widget _buildContent() {
if (appState.isLoading) {
return _buildLoadingIndicator();
} else if (!appState.isLoading && appState.user == null) {
return new LoginScreen();
} else {
return _buildStories();
}
}
Scaffold _buildLoadingIndicator() {
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: <Widget>[
Container(
decoration: BoxDecoration(color: Colors.black54),
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 2,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircleAvatar(
backgroundColor: Colors.white,
radius: 50.0,
child: Image(image: AssetImage('images/work.png')),
),
Padding(
padding: EdgeInsets.only(top: 10.0),
),
Text(
"Chrona",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 24.0),
)
],
),
),
),
Expanded(
flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Loading...Please wait",
softWrap: true,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
color: Colors.white),
),
Padding(
padding: EdgeInsets.only(top: 20.0),
),
CircularProgressIndicator(),
Padding(
padding: EdgeInsets.only(top: 20.0),
),
Text(
"Get the information you need. Anytime. Anywhere.",
softWrap: true,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
color: Colors.white),
)
],
),
)
],
)
],
),
);
}
@override
Widget build(BuildContext context) {
// Build the content depending on the state:
appState = StateWidget.of(context).state;
StaticState.user = appState.user;
return _buildContent();
}
void check() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
int counter = (prefs.getInt(appState.user.email) ?? 0);
if (counter == 0)
Navigator.push(
context, MaterialPageRoute(builder: (context) => TopicRoute()));
else {
Navigator.push(
context, MaterialPageRoute(builder: (context) => NewsMain()));
}
}
void topic() {
Navigator.push(context, MaterialPageRoute(builder: (context)=>TopicRoute()));
}
void signOut() async{
final GoogleSignIn _googleSignIn = GoogleSignIn();
final FirebaseAuth _auth = FirebaseAuth.instance;
await _auth.signOut();
await _googleSignIn.signOut();
StaticState.user=null;
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>LoginScreen()));
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/article.dart
|
import 'package:chrona_1/Activities/add_article.dart';
import 'package:chrona_1/Activities/article_component.dart';
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flutter/material.dart';
import 'account.dart';
import 'main.dart';
class Article extends StatefulWidget {
@override
_ArticleState createState() => _ArticleState();
}
class _ArticleState extends State<Article> {
int selectedIndex = 2;
FirebaseDatabase firebaseDatabase = FirebaseDatabase.instance;
DatabaseReference databaseReferenceArticle,databaseReferenceUser;
@override
void setState(VoidCallback fn) {}
@override
void initState() {
super.initState();
databaseReferenceArticle = firebaseDatabase.reference().child("Article");
databaseReferenceUser=firebaseDatabase.reference().child("Users");
}
TextEditingController headerController = new TextEditingController();
TextEditingController bodyController = new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text("Articles"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
new Flexible(
child: new FirebaseAnimatedList(
query: databaseReferenceArticle
.orderByChild("verify")
.equalTo(true),
padding: new EdgeInsets.all(8.0),
reverse: false,
itemBuilder: (_, DataSnapshot snapshot,
Animation<double> animation, int x) {
return ArticleComponent(snapshot:snapshot);
// print(snapshot.value);
// debugPrint(snapshot.value["user"]+" 0 "+StaticState.user.email);
}),
)
],
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
elevation: 5.0,
onPressed: addArticle,
backgroundColor: Colors.redAccent,
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description),
title: new Text("Article"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void addArticle() {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => AddArticle()));
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 1) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Question_Route()));
}
if (value == 3) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Account()));
//selectedIndex=2;
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/Activities/add_answer.dart
|
import 'dart:convert';
import 'package:chrona_1/Activities/question.dart';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'account.dart';
import 'article.dart';
import 'main.dart';
class AddAnswer extends StatefulWidget {
String ques;
String KEY;
AddAnswer(this.ques, this.KEY);
@override
_AddAnswerState createState() => _AddAnswerState(ques, KEY);
}
class _AddAnswerState extends State<AddAnswer> {
int selectedIndex = 1;
DatabaseReference databaseReference;
FirebaseDatabase firebaseDatabase;
String ques, KEY;
_AddAnswerState(this.ques, this.KEY);
@override
void initState() {
firebaseDatabase = FirebaseDatabase.instance;
databaseReference = firebaseDatabase.reference().child("Question");
}
TextEditingController answer = new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: new Text("Add Answer"),
actions: <Widget>[
IconButton(
icon: CircleAvatar(
radius: 18.0,
backgroundImage: NetworkImage(StaticState.user.photoUrl),
backgroundColor: Colors.transparent,
),
)
],
backgroundColor: Colors.black,
),
body: new Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(8.0),
),
TextFormField(
readOnly: true,
autocorrect: true,
autofocus: false,
initialValue: ques,
maxLength: 256,
maxLines: 4,
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Question",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
)),
),
Padding(
padding: EdgeInsets.all(8.0),
),
TextField(
autocorrect: true,
autofocus: true,
controller: answer,
maxLength: 512,
maxLines: 10,
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
labelText: "Answer",
hintText: 'Write Your answer here ',
prefixIcon: Icon(Icons.description),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
))),
Padding(
padding: EdgeInsets.all(8.0),
),
RaisedButton(
onPressed: () => submit(context),
child: Text("Submit"),
elevation: 5.0,
)
],
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: new Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.question_answer),
title: new Text("Q/A"),
backgroundColor: Colors.black),
BottomNavigationBarItem(
icon: Icon(Icons.description), title: new Text("Article")),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), title: new Text("Account"))
],
currentIndex: selectedIndex,
selectedItemColor: Colors.red,
onTap: _ontappeditem,
));
}
void _ontappeditem(int value) {
if (value == 0) {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (context) => NewsMain()));
// selectedIndex=0;
}
if (value == 1) {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (context) => Question_Route()));
}
if (value == 2) {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (context) => Article()));
}
if (value == 3) {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (context) => Account()));
}
}
void submit(BuildContext context) {
if (answer.text.isEmpty) {
Flushbar(
padding: EdgeInsets.all(10.0),
borderRadius: 8,
backgroundGradient: LinearGradient(
colors: [Colors.amber.shade500, Colors.orange.shade500],
stops: [0.5, 1],
),
boxShadows: [
BoxShadow(
color: Colors.black45,
offset: Offset(3, 3),
blurRadius: 3,
),
],
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
forwardAnimationCurve: Curves.fastLinearToSlowEaseIn,
title: 'Something Missing!!!',
message: 'Check whether you have written your answer or not.',
duration: Duration(seconds: 4),
)..show(context);
} else {
var firstChunk = utf8.encode(answer.text);
var secondChunk = utf8.encode(StaticState.user.email);
var output = new AccumulatorSink<Digest>();
var input = sha1.startChunkedConversion(output);
input.add(firstChunk);
input.add(secondChunk); // call `add` for every chunk of input data
input.close();
var digest = output.events.single;
databaseReference.child(KEY).child("Answer").child(digest.toString()).set({
"answer": answer.text,
"user": StaticState.user.email.toString(),
"username": StaticState.user.displayName.toString(),
"likes": [],
"likeCount":0,
"dislikes": [],
"dislikeCount":0,
});
Navigator.pop(context);
}
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/news/web_view.dart
|
import 'package:chrona_1/news/model/news.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class WebView extends StatefulWidget {
final String url;
// final Source source;
final String src;
// WebView.account(this.url,this.src,);
WebView(this.url, this.src);
@override
_WebViewExampleState createState() => _WebViewExampleState();
}
class _WebViewExampleState extends State<WebView> {
@override
Widget build(BuildContext context) {
return WebviewScaffold(
appBar: AppBar(
title: Text(widget.src),
// backgroundColor: Colors.black,
),
url: widget.url,
);
}
}
| 0
|
mirrored_repositories/Chrona/lib
|
mirrored_repositories/Chrona/lib/news/news_list.dart
|
import 'dart:async';
import 'dart:convert';
import 'package:chrona_1/UserInfo/state.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:http/http.dart' as http;
import 'model/news.dart';
import 'news_details.dart';
class NewsListPage extends StatefulWidget {
final String title;
final String newsType;
NewsListPage(this.title, this.newsType);
@override
_NewsListPageState createState() => _NewsListPageState();
}
class _NewsListPageState extends State<NewsListPage> {
FirebaseDatabase firebaseDatabase;
DatabaseReference databaseReferencelike,databaseReferencedislike;
@override
void initState() {
String s=StaticState.user.email;
s=s.substring(0,s.indexOf("@"));
firebaseDatabase=FirebaseDatabase.instance;
databaseReferencelike=firebaseDatabase.reference().child("Users").child(s).child("News").child("Likes");
databaseReferencedislike=firebaseDatabase.reference().child("Users").child(s).child("News").child("Dislikes");
super.initState();
}
var size;
Future<List<Article>> getData(String newsType) async {
List<Article> list;
String link;
if (newsType == "top_news") {
link =
"https://newsapi.org/v2/top-headlines?country=in&apiKey=36bbc55c610e417e8b80512b6ea9e7c5";
}
else if(newsType == "global") {
link=
"https://newsapi.org/v2/everything?domains=bbc.com,foxnews.com,cnn.com&sortBy=popularity&apiKey=36bbc55c610e417e8b80512b6ea9e7c5";
}
else if(newsType == "gaming") {
link=
"https://newsapi.org/v2/everything?domains=ign.com&sortBy=popularity&apiKey=36bbc55c610e417e8b80512b6ea9e7c5";
}
else if(newsType == "automobiles") {
link=
"https://newsapi.org/v2/everything?domains=autonews.com,thedrive.com,autocarindia.com&sortBy=popularity&apiKey=36bbc55c610e417e8b80512b6ea9e7c5";
}
else {
link =
"https://newsapi.org/v2/top-headlines?country=in&category=$newsType&apiKey=36bbc55c610e417e8b80512b6ea9e7c5";
}
print(link);
var res = await http
.get(Uri.encodeFull(link), headers: {"Accept": "application/json"});
if (res.statusCode == 200) {
var data = json.decode(res.body);
var rest = data["articles"] as List;
list = rest.map<Article>((json) => Article.fromJson(json)).toList();
}
return list;
}
Widget listViewWidget(List<Article> article) {
return Container(
child: ListView.builder(
itemCount: article.length,
padding: const EdgeInsets.all(2.0),
itemBuilder: (context, position) {
return Slidable(
actionPane: SlidableDrawerActionPane(),
actionExtentRatio: 0.20,
child: Card(
child: Container(
height: 120.0,
width: 120.0,
child: Center(
child: ListTile(
subtitle: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Text(
'${article[position].source.name}',
),
),
title: Text(
'${article[position].title}',
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold),
),
leading: Container(
height: 100.0,
width: 100.0,
child: article[position].urlToImage == null
? Image.asset(
'images/no_image_available.png',
height: 70,
width: 70,
)
: Image.network(
'${article[position].urlToImage}',
height: 70,
width: 70,
),
),
onTap: () => _onTapItem(context, article[position]),
),
),
),
),
secondaryActions: <Widget>[
IconSlideAction(
caption: 'Like',
color: Colors.blue,
icon: Icons.check,
onTap: () => Like(article[position]),
),
IconSlideAction(
caption: 'Dislike',
color: Colors.red,
icon: Icons.clear,
onTap: () => Dislike(article[position]),
),
],
);
}));
}
void _onTapItem(BuildContext context, Article article) {
Navigator.push(context, MaterialPageRoute(builder: (context)=>NewsDetails(article, widget.title)));
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: Text(widget.title),
backgroundColor: Colors.black,
),
body: new Stack(children: <Widget>[
new Image.asset(
'images/b1.jpg',
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
fit: BoxFit.cover,
),
FutureBuilder(
future: getData(widget.newsType),
builder: (context, snapshot) {
return snapshot.data != null
? listViewWidget(snapshot.data)
: Center(child: CircularProgressIndicator());
}),
]));
}
Like(Article article) {
databaseReferencelike.push().set(article.toJson());
}
Dislike(Article article) {
databaseReferencedislike.push().set({"title":article.title,"url":article.url,"source":article.source.name});
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.