repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/openreads/lib/ui/book_screen | mirrored_repositories/openreads/lib/ui/book_screen/widgets/book_title_detail.dart | import 'package:diacritic/diacritic.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:openreads/core/constants/enums/enums.dart';
import 'package:openreads/core/themes/app_theme.dart';
import 'package:openreads/generated/locale_keys.g.dart';
import 'package:openreads/ui/similiar_books_screen/similiar_books_screen.dart';
class BookTitleDetail extends StatelessWidget {
const BookTitleDetail({
super.key,
required this.title,
required this.subtitle,
required this.author,
required this.publicationYear,
required this.bookType,
this.tags,
});
final String title;
final String? subtitle;
final String author;
final String publicationYear;
final BookFormat bookType;
final List<String>? tags;
Widget _buildTagChip({
required String tag,
required BuildContext context,
}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: FilterChip(
backgroundColor: Theme.of(context).colorScheme.secondary,
side: BorderSide(
color: dividerColor,
width: 1,
),
label: Text(
tag,
overflow: TextOverflow.fade,
softWrap: true,
maxLines: 5,
style: TextStyle(
color: Theme.of(context).colorScheme.onSecondary,
),
),
clipBehavior: Clip.none,
onSelected: (_) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SimiliarBooksScreen(
tag: tag,
),
),
);
},
),
);
}
List<Widget> _generateTagChips({required BuildContext context}) {
final chips = List<Widget>.empty(growable: true);
if (tags == null) {
return [];
}
tags!.sort((a, b) => removeDiacritics(a.toLowerCase())
.compareTo(removeDiacritics(b.toLowerCase())));
for (var tag in tags!) {
chips.add(_buildTagChip(
tag: tag,
context: context,
));
}
return chips;
}
void _navigateToSimiliarAuthorBooksScreen(BuildContext context) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SimiliarBooksScreen(
author: author,
),
),
);
}
@override
Widget build(BuildContext context) {
return Card(
shadowColor: Colors.transparent,
shape: RoundedRectangleBorder(
side: BorderSide(color: dividerColor, width: 1),
borderRadius: BorderRadius.circular(cornerRadius),
),
child: Container(
padding: const EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(5, 5, 5, 0),
child: Text(
title,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
subtitle != null
? Padding(
padding: const EdgeInsets.fromLTRB(5, 0, 5, 0),
child: Text(
subtitle!,
style: const TextStyle(
fontSize: 18,
),
),
)
: const SizedBox(),
const Divider(height: 5),
const SizedBox(height: 10),
InkWell(
borderRadius: BorderRadius.circular(cornerRadius),
onTap: () => _navigateToSimiliarAuthorBooksScreen(context),
child: Padding(
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
child: Text(
author,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
),
(publicationYear != '')
? Padding(
padding: const EdgeInsets.fromLTRB(5, 0, 5, 0),
child: Text(
publicationYear,
style: TextStyle(
fontSize: 15,
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.7),
),
),
)
: const SizedBox(),
const SizedBox(height: 5),
Padding(
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
FaIcon(
bookType == BookFormat.audiobook
? FontAwesomeIcons.headphones
: bookType == BookFormat.ebook
? FontAwesomeIcons.tabletScreenButton
: FontAwesomeIcons.bookOpen,
size: 16,
color:
Theme.of(context).colorScheme.primary.withOpacity(0.7),
),
const SizedBox(width: 10),
Text(
bookType == BookFormat.audiobook
? LocaleKeys.book_format_audiobook.tr()
: bookType == BookFormat.ebook
? LocaleKeys.book_format_ebook.tr()
: bookType == BookFormat.hardcover
? LocaleKeys.book_format_hardcover.tr()
: LocaleKeys.book_format_paperback.tr(),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.7),
),
),
],
),
),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 5,
horizontal: 0,
),
child: Wrap(
children: _generateTagChips(context: context),
),
),
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/openreads/lib/ui/book_screen | mirrored_repositories/openreads/lib/ui/book_screen/widgets/book_detail.dart | import 'package:flutter/material.dart';
import 'package:openreads/core/themes/app_theme.dart';
class BookDetail extends StatelessWidget {
const BookDetail({
super.key,
required this.title,
required this.text,
});
final String title;
final String text;
@override
Widget build(BuildContext context) {
return Card(
shadowColor: Colors.transparent,
shape: RoundedRectangleBorder(
side: BorderSide(color: dividerColor, width: 1),
borderRadius: BorderRadius.circular(cornerRadius),
),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
title,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
Text(
text,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/openreads/lib/ui | mirrored_repositories/openreads/lib/ui/unfinished_screen/unfinished_screen.dart | import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:openreads/generated/locale_keys.g.dart';
import 'package:openreads/main.dart';
import 'package:openreads/model/book.dart';
import 'package:openreads/ui/books_screen/widgets/widgets.dart';
class UnfinishedScreen extends StatelessWidget {
const UnfinishedScreen({super.key});
@override
Widget build(BuildContext context) {
bookCubit.getUnfinishedBooks();
return Scaffold(
appBar: AppBar(
title: Text(
LocaleKeys.unfinished_books.tr(),
style: const TextStyle(fontSize: 18),
),
),
body: StreamBuilder<List<Book>>(
stream: bookCubit.unfinishedBooks,
builder: (context, AsyncSnapshot<List<Book>> snapshot) {
if (snapshot.hasData) {
if (snapshot.data == null || snapshot.data!.isEmpty) {
return Center(
child: Padding(
padding: const EdgeInsets.all(50),
child: Text(
LocaleKeys.no_unfinished_books.tr(),
textAlign: TextAlign.center,
style: const TextStyle(
letterSpacing: 1.5,
fontSize: 16,
),
),
),
);
}
return BooksList(
books: snapshot.data!,
listNumber: 6,
allBooksCount: null,
);
} else if (snapshot.hasError) {
return Text(
snapshot.error.toString(),
);
} else {
return const SizedBox();
}
},
),
);
}
}
| 0 |
mirrored_repositories/flutter_light_dark_theme | mirrored_repositories/flutter_light_dark_theme/lib/main.dart | import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_light_dark_theme/helpers/themes.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return DynamicTheme(
themeCollection: themeCollection,
defaultThemeId: AppThemes.Light,
builder: ((context, themeData) => MaterialApp(
theme: themeData,
debugShowCheckedModeBanner: false,
home: const MyHomePage(title: 'Flutter Light Dark Theme'),
)),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
final themeIdText = DynamicTheme.of(context)?.themeId;
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
title: Text(
widget.title,
style: Theme.of(context).textTheme.headline6,
),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(20)),
child: MaterialButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
onPressed: () {
final themeId = DynamicTheme.of(context)?.themeId;
if (themeId == 0) {
DynamicTheme.of(context)!.setTheme(AppThemes.Dark);
} else {
DynamicTheme.of(context)!.setTheme(AppThemes.Light);
}
},
child: Text(
themeIdText == 0 ? "Light" : "Dark",
style: Theme.of(context).textTheme.bodyLarge,
),
),
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_light_dark_theme/lib | mirrored_repositories/flutter_light_dark_theme/lib/helpers/themes.dart | // ignore_for_file: constant_identifier_names, prefer_const_constructors
import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_light_dark_theme/helpers/app_config.dart' as config;
class AppThemes {
static const int Light = 0;
static const int Dark = 1;
}
final themeCollection = ThemeCollection(
themes: {
AppThemes.Light: ThemeData(
primaryColor: config.Colors().primaryColor,
bottomAppBarColor: config.Colors().whiteColor,
scaffoldBackgroundColor: Color(0xFFeeeeee),
iconTheme: IconThemeData(color: config.Colors().blackColor),
inputDecorationTheme: InputDecorationTheme(
fillColor: Color.fromARGB(255, 220, 220, 220), filled: true),
textTheme: TextTheme(
headline1: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w600,
color: config.Colors().blackColor),
headline2: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: config.Colors().blackColor),
headline3: TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.w700,
color: config.Colors().blackColor),
headline4: TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.w300,
color: config.Colors().blackColor),
headline5: TextStyle(fontSize: 20.0, color: config.Colors().blackColor),
headline6: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: config.Colors().blackColor),
subtitle1: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w500,
color: config.Colors().blackColor),
subtitle2: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w500,
color: config.Colors().blackColor),
bodyText1: TextStyle(fontSize: 14.0, color: config.Colors().blackColor),
bodyText2: TextStyle(fontSize: 12.0, color: config.Colors().blackColor),
caption: TextStyle(fontSize: 12.0, color: config.Colors().blackColor),
),
),
AppThemes.Dark: ThemeData(
fontFamily: 'Raleway',
primaryColor: config.Colors().primaryColor,
inputDecorationTheme: InputDecorationTheme(
fillColor: Color.fromARGB(255, 61, 61, 61), filled: true),
bottomAppBarColor: Color.fromARGB(255, 61, 61, 61),
scaffoldBackgroundColor: config.Colors().blackColor,
iconTheme: IconThemeData(color: config.Colors().whiteColor),
textTheme: TextTheme(
headline1: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w600,
color: config.Colors().whiteColor),
headline2: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: config.Colors().whiteColor),
headline3: TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.w700,
color: config.Colors().whiteColor),
headline4: TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.w300,
color: config.Colors().whiteColor),
headline5: TextStyle(fontSize: 20.0, color: config.Colors().whiteColor),
headline6: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: config.Colors().whiteColor),
subtitle1: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w500,
color: config.Colors().whiteColor),
subtitle2: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w500,
color: config.Colors().whiteColor),
bodyText1: TextStyle(fontSize: 14.0, color: config.Colors().whiteColor),
bodyText2: TextStyle(fontSize: 12.0, color: config.Colors().whiteColor),
caption: TextStyle(fontSize: 12.0, color: config.Colors().primaryColor),
),
),
},
fallbackTheme: ThemeData.light(),
);
| 0 |
mirrored_repositories/flutter_light_dark_theme/lib | mirrored_repositories/flutter_light_dark_theme/lib/helpers/app_config.dart | import 'package:flutter/material.dart';
class Colors {
Color primaryColor = const Color(0xFFFE9205);
Color brownColor = const Color(0xff47381E);
Color blackColor = const Color(0xff242324);
Color whiteColor = const Color(0xffffffff);
}
| 0 |
mirrored_repositories/flutter_light_dark_theme | mirrored_repositories/flutter_light_dark_theme/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:flutter_light_dark_theme/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/Pagination-in-Flutter | mirrored_repositories/Pagination-in-Flutter/lib/main.dart | /*
Aim : Paginating the data while
loading from a database or from an API
Pros : Reduces the Database maintainence
and pricing of the database
Imagine you are having an app which is having
about 100K+ downloads and 10K+ daily users everyday
and users perform read operations in order to
load data. when an app having 10K+ daily users
will perform 100K+ to 1Million reads per day
and it again deponds on how optimally you have
developed the app.
So, in order to reduce the database maintainence,
Developers can use pagination in your app
which reduces the reads and loading the amount of data
which is required for the user.
So, Enough intro, let's start coding
*/
/*
In this context we are not actually loading the
data from database or API but we actually performed
a pagination example.
*/
import 'package:flutter/material.dart';
int count = 15;
void main() {
runApp(MaterialApp(
title: 'Pagination in Flutter',
home: Home(),
));
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
ScrollController _scrollController = ScrollController();
bool getmoreflag = false;
void getMoreData() {
print(count);
print("Loading.. more data");
Future.delayed(Duration(seconds: 2), () {
setState(() {
count = count + 15;
getmoreflag = false;
});
});
}
@override
void initState() {
_scrollController.addListener(() {
double maxScroll = _scrollController.position.maxScrollExtent;
double currentScroll = _scrollController.position.pixels;
double delta = MediaQuery.of(context).size.height * 0.70;
if (maxScroll - currentScroll <= delta) {
//Load data more data
if (!getmoreflag) {
setState(() {
getmoreflag = true;
});
getMoreData();
}
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Pagination in Flutter"),
centerTitle: true,
),
body: Container(
child: ListView.builder(
controller: _scrollController,
itemCount: count,
itemBuilder: (context, i) {
if (i == count - 1) {
return Center(
child: Container(
padding: EdgeInsets.all(10.0),
child: CircularProgressIndicator(),
),
);
}
return ListTile(
title: Text(i.toString()),
);
},
),
),
);
}
}
| 0 |
mirrored_repositories/simbasa | mirrored_repositories/simbasa/lib/main.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:simbasa/provider/HomaPageProvider.dart';
import 'package:simbasa/provider/SetoranProvider.dart';
import 'package:simbasa/view/SplashScreenPage/SplashscreenPage.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(
create: (_) => HomePageProvider(),
),
ChangeNotifierProvider(
create: (_) => SetoranProvider(),
),
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'simbasa',
home: SplashScreenPage(),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view | mirrored_repositories/simbasa/lib/view/DasboardPage/DashboardPage.dart | import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import 'package:simbasa/model/HomePageModel.dart';
import 'package:simbasa/provider/HomaPageProvider.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/DasboardPage/HomePage/HomePage.dart';
import 'package:simbasa/view/DasboardPage/TransactionsPage/AddNasabahPage.dart';
import 'package:simbasa/view/DasboardPage/TransactionsPage/PenarikanPage.dart';
import 'package:simbasa/view/DasboardPage/TransactionsPage/PenjualanPage.dart';
import 'package:simbasa/view/DasboardPage/TransactionsPage/PenyetoranPage.dart';
import 'package:simbasa/view/DasboardPage/UserBottomSheetFialog/UserBottomSheetDialog.dart';
import 'package:simbasa/view/DasboardPage/component/component.dart';
class DashboardPage extends StatefulWidget {
final String username;
const DashboardPage({@required this.username});
@override
_DashboardPageState createState() => _DashboardPageState();
}
class _DashboardPageState extends State<DashboardPage> {
int _bottomNavBarSelectedIndex = 0;
bool _addButton = false;
@override
Widget build(BuildContext context) {
final List<Widget> _children = [
FutureBuilder<HomePageModel>(
future: Provider.of<HomePageProvider>(context, listen: false).getHomePageData(),
builder: (BuildContext context, snapshot) {
return HomePage(
homepage: snapshot.data,
);
},
),
Container(),
];
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
title: Text("Profile"),
),
],
currentIndex: _bottomNavBarSelectedIndex,
selectedItemColor: Colors.green,
onTap: _onPressed,
),
floatingActionButton: Padding(
padding: const EdgeInsets.only(
bottom: 12,
),
child: Container(
alignment: Alignment.bottomCenter,
margin: const EdgeInsets.only(left: 31, bottom: 20),
child: RawMaterialButton(
onPressed: _onPressedAdd,
fillColor: Colors.amber,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
elevation: 2,
child: Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12),
child: Text(
"+",
style: TypographyStyle.title,
),
),
),
),
),
body: Stack(
children: [
_children[_bottomNavBarSelectedIndex],
AnimatedSwitcher(
duration: const Duration(milliseconds: 150),
child: (_addButton)
? GestureDetector(
onTap: () {
setState(() {
_addButton = false;
});
},
child: Container(
padding: const EdgeInsets.all(8.0),
color: PaletteColor.grey.withOpacity(0.3),
child: Container(
margin: EdgeInsets.only(
left: MediaQuery.of(context).size.width / 2),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
card(
title: "Penjualan",
icon: Icon(Icons.description),
onPressed: () {
print("a");
setState(() {
_addButton = false;
});
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PenjualanPage(),
),
);
}),
card(
title: "Penyetoran",
icon: Icon(Icons.movie),
onPressed: () {
print("a");
setState(() {
_addButton = false;
});
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PenyetoranPage(),
),
);
},
),
card(
title: "Penarikan",
icon: Icon(Icons.source),
onPressed: () {
print("a");
setState(() {
_addButton = false;
});
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PenarikanPage(),
),
);
},
),
card(
title: "Add Nasabah",
icon: Icon(Icons.link),
onPressed: () {
setState(() {
_addButton = false;
});
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AddNasabahPage(),
),
);
},
),
SizedBox(
height: 30,
),
],
),
),
),
)
: SizedBox.shrink(),
),
],
),
);
}
void _onPressed(index) {
if (index == 0) print("Home");
if (index == 1)
showModalBottomSheet(
context: context,
builder: (BuildContext context) => UserBottomSheetDialog(ctx: context),
);
}
void _onPressedAdd() {
setState(() {
if (!_addButton)
_addButton = true;
else
_addButton = false;
});
print(_addButton);
// showDialog(
// context: context,
// builder: (context) => AlertDialog(
//
// ),
// );
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/component/component.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
InkWell card({String title, Icon icon, Function onPressed}) {
return InkWell(
onTap: onPressed,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
padding: const EdgeInsets.all(12),
child: Row(
children: [
Container(
child: Container(
width: 40,
height: 40,
child: icon,
decoration: BoxDecoration(
shape: BoxShape.circle, color: Color(0xFFe0f2f1)),
),
),
Padding(
padding: const EdgeInsets.only(left: 12),
child: Text(title),
),
],
),
),
),
);
}
ListTile listTile(
{String title, String subtitle, String mini, Function onPressed}) {
return ListTile(
onTap: onPressed,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
subtitle,
style: TypographyStyle.paragraph,
),
Text(
title,
style: TypographyStyle.subtitle1,
),
],
),
subtitle: Text(mini, style: TypographyStyle.mini.merge(TextStyle(color: PaletteColor.green))),
leading: Padding(
padding: const EdgeInsets.only(left: 8, top: 4),
child: Icon(
Icons.people,
size: 42,
),
),
);
}
Widget listTile2({String subtitle, String amount, String kg, String date, Function onPressed, Function onLongPressed, int index}) {
return Card(
child: InkWell(
onTap: () {},
onLongPress: onLongPressed,
child: Container(
padding: const EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(index.toString() + "."),
SizedBox(
width: 80,
child: Text(subtitle),
),
SizedBox(
width: 80,
child: Align(alignment: Alignment.bottomLeft, child: Text("Rp " + amount)),
),
SizedBox(
width: 80,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Last Activity", style: TypographyStyle.mini,),
Text(date),
],
),
),
],
),
),
),
);
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage/component | mirrored_repositories/simbasa/lib/view/DasboardPage/component/chart/linecart.dart | import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
class LineChartSample2 extends StatefulWidget {
@override
_LineChartSample2State createState() => _LineChartSample2State();
}
class _LineChartSample2State extends State<LineChartSample2> {
List<Color> gradientColors = [
const Color(0xff23b6e6),
const Color(0xff02d39a),
];
bool showAvg = false;
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 8, right: 8),
height: MediaQuery.of(context).size.height / 3,
child: Stack(
children: <Widget>[
AspectRatio(
aspectRatio: 1.70,
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(18),
),
color: PaletteColor.primarybg2),
child: Padding(
padding: const EdgeInsets.only(
right: 12.0, left: 12.0, top: 24, bottom: 12),
child: LineChart(
showAvg ? avgData() : mainData(),
),
),
),
),
SizedBox(
width: 60,
height: 34,
child: TextButton(
onPressed: () {
setState(() {
showAvg = !showAvg;
});
},
child: Text(
'avg',
style: TextStyle(
fontSize: 12,
color: showAvg
? Colors.black87.withOpacity(0.5)
: Colors.black87,
),
),
),
)
],
),
);
}
LineChartData mainData() {
return LineChartData(
gridData: FlGridData(
show: true,
drawVerticalLine: true,
getDrawingHorizontalLine: (value) {
return FlLine(
color: const Color(0xff37434d),
strokeWidth: 1,
);
},
getDrawingVerticalLine: (value) {
return FlLine(
color: const Color(0xff37434d),
strokeWidth: 1,
);
},
),
titlesData: FlTitlesData(
show: true,
bottomTitles: SideTitles(
showTitles: true,
reservedSize: 22,
getTextStyles: (value) => const TextStyle(
color: Color(0xff68737d),
fontWeight: FontWeight.bold,
fontSize: 12),
getTitles: (value) {
switch (value.toInt()) {
case 1:
return 'JAN';
case 4:
return 'MAR';
case 7:
return 'MEI';
case 10:
return 'JUL';
}
return '';
},
margin: 8,
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
color: Color(0xff67727d),
fontWeight: FontWeight.bold,
fontSize: 12,
),
getTitles: (value) {
switch (value.toInt()) {
case 1:
return '10k';
case 3:
return '30k';
case 5:
return '50k';
case 7:
return '70k';
}
return '';
},
reservedSize: 28,
margin: 12,
),
),
borderData: FlBorderData(
show: true,
border: Border.all(color: const Color(0xff37434d), width: 1)),
minX: 0,
maxX: 11,
minY: 0,
maxY: 6,
lineBarsData: [
LineChartBarData(
spots: [
FlSpot(0, 0),
FlSpot(2.6, 0),
FlSpot(4.9, 0),
FlSpot(6.8, 0),
FlSpot(8, 0),
FlSpot(9.5, 0),
FlSpot(11, 1),
],
isCurved: true,
colors: gradientColors,
barWidth: 5,
isStrokeCapRound: true,
dotData: FlDotData(
show: false,
),
belowBarData: BarAreaData(
show: true,
colors:
gradientColors.map((color) => color.withOpacity(0.3)).toList(),
),
),
],
);
}
LineChartData avgData() {
return LineChartData(
lineTouchData: LineTouchData(enabled: false),
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
getDrawingVerticalLine: (value) {
return FlLine(
color: const Color(0xff37434d),
strokeWidth: 1,
);
},
getDrawingHorizontalLine: (value) {
return FlLine(
color: const Color(0xff37434d),
strokeWidth: 1,
);
},
),
titlesData: FlTitlesData(
show: true,
bottomTitles: SideTitles(
showTitles: true,
reservedSize: 22,
getTextStyles: (value) => const TextStyle(
color: Color(0xff68737d),
fontWeight: FontWeight.bold,
fontSize: 12),
getTitles: (value) {
switch (value.toInt()) {
case 2:
return 'MAR';
case 5:
return 'JUN';
case 8:
return 'SEP';
}
return '';
},
margin: 8,
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
color: Color(0xff67727d),
fontWeight: FontWeight.bold,
fontSize: 12,
),
getTitles: (value) {
switch (value.toInt()) {
case 1:
return '10k';
case 3:
return '30k';
case 5:
return '50k';
}
return '';
},
reservedSize: 28,
margin: 12,
),
),
borderData: FlBorderData(
show: true,
border: Border.all(color: const Color(0xff37434d), width: 1),
),
minX: 0,
maxX: 11,
minY: 0,
maxY: 6,
lineBarsData: [
LineChartBarData(
spots: [
FlSpot(0, 3.44),
FlSpot(2.6, 3.44),
FlSpot(4.9, 3.44),
FlSpot(6.8, 3.44),
FlSpot(8, 3.44),
FlSpot(9.5, 3.44),
FlSpot(11, 3.44),
],
isCurved: true,
colors: [
ColorTween(begin: gradientColors[0], end: gradientColors[1])
.lerp(0.2),
ColorTween(begin: gradientColors[0], end: gradientColors[1])
.lerp(0.2),
],
barWidth: 5,
isStrokeCapRound: true,
dotData: FlDotData(
show: false,
),
belowBarData: BarAreaData(show: true, colors: [
ColorTween(begin: gradientColors[0], end: gradientColors[1])
.lerp(0.2)
.withOpacity(0.1),
ColorTween(begin: gradientColors[0], end: gradientColors[1])
.lerp(0.2)
.withOpacity(0.1),
]),
),
],
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/TransactionsPage/PenjualanPage.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
import 'package:flutter/cupertino.dart';
class PenjualanPage extends StatefulWidget {
@override
_PenjualanPageState createState() => _PenjualanPageState();
}
enum SingingCharacter { organik, anorganik }
enum SingingCharacter2 { confirm }
class _PenjualanPageState extends State<PenjualanPage> {
SingingCharacter _character = SingingCharacter.organik;
SingingCharacter2 _character2 = SingingCharacter2.confirm;
final TextEditingController _jumlahInput = new TextEditingController();
final TextEditingController _totalInput = new TextEditingController();
// final TextEditingController _kelaminInput = new TextEditingController();
// final TextEditingController _tempatlahirInput = new TextEditingController();
// final TextEditingController _statusInput = new TextEditingController();
// final TextEditingController _pekerjaanInput = new TextEditingController();
// final TextEditingController _tlpInput = new TextEditingController();
// final TextEditingController _rekInput = new TextEditingController();
// final TextEditingController _saldoInput = new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Penjualan",
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
alignment: Alignment.bottomCenter,
child: Column(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
ListTile(
title: Text(('Jumlah jual')),
),
TextFormField(
// validator: (val){
// if (val.length==0){
// return "empty";
// }else{
// return null;
// }
// },
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'jumlah jual',
labelStyle: TextStyle(fontSize: 20),
),
controller: _jumlahInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('total jual')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'total jual',
labelStyle: TextStyle(fontSize: 20),
),
controller: _totalInput,
),
SizedBox(height: 20,),
ListTile(title: Text('Jenis Sampah'),),
ListTile(
title: const Text('organik'),
leading: Radio<SingingCharacter>(
value: SingingCharacter.organik,
groupValue: _character,
onChanged: (SingingCharacter value){
setState(() {
_character = value;
});
},
),
),
ListTile(
title: const Text('an organik'),
leading: Radio<SingingCharacter>(
value: SingingCharacter.anorganik,
groupValue: _character,
onChanged: (SingingCharacter value){
setState(() {
_character = value;
});
},
),
),
ListTile(title: Text('jual Sampah'),),
ListTile(
title: const Text('confirm'),
leading: Radio<SingingCharacter2>(
value: SingingCharacter2.confirm,
groupValue: _character2,
onChanged: (SingingCharacter2 value2){
setState(() {
_character2 = value2;
});
},
),
),
],
),
),
Container(
margin: const EdgeInsets.all(12),
alignment: Alignment.bottomCenter,
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: FlatButton(
height: 48,
color: PaletteColor.primary,
splashColor: PaletteColor.primary80,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3.0),
side: BorderSide(
color: PaletteColor.red,
),
),
onPressed: () {},
child: Text(
"jual sekarang",
style: TypographyStyle.button1.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/TransactionsPage/AddNasabahPage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:simbasa/provider/CreateProvider.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
class AddNasabahPage extends StatefulWidget {
@override
_AddNasabahPageState createState() => _AddNasabahPageState();
}
class _AddNasabahPageState extends State<AddNasabahPage> {
final TextEditingController _usernameInput = new TextEditingController();
final TextEditingController _namaInput = new TextEditingController();
final TextEditingController _alamatInput = new TextEditingController();
final TextEditingController _pekerjaanInput = new TextEditingController();
final TextEditingController _tlpInput = new TextEditingController();
final TextEditingController _rekInput = new TextEditingController();
final TextEditingController _saldoInput = new TextEditingController();
final TextEditingController _passInput = new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Add Nasabah",
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
alignment: Alignment.bottomCenter,
child: Column(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
children: [
ListTile(
title: Text(('Masukan Username')),
),
TextFormField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Username',
labelStyle: TextStyle(fontSize: 20),
),
controller: _usernameInput,
),
ListTile(
title: Text(('Masukan Nama Nasabah')),
),
TextFormField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Nama',
labelStyle: TextStyle(fontSize: 20),
),
controller: _namaInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Masukan Nama Alamat')),
),
TextFormField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Alamat',
labelStyle: TextStyle(fontSize: 20),
),
controller: _alamatInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Masukan Pekerjaan Nasabah')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Pekerjaan',
labelStyle: TextStyle(fontSize: 20),
),
controller: _pekerjaanInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Masukan Nomor Telpon Nasabah')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Telpon',
labelStyle: TextStyle(fontSize: 20),
),
keyboardType: TextInputType.number,
controller: _tlpInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Masukan Nomor Rekening Nasabah')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Nomor Rekening',
labelStyle: TextStyle(fontSize: 20),
),
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly
],
controller: _rekInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Jumlah Saldo Nasabah')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'saldo',
labelStyle: TextStyle(fontSize: 20),
),
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly
],
controller: _saldoInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Jumlah Saldo Password')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Password',
labelStyle: TextStyle(fontSize: 20),
),
controller: _passInput,
),
SizedBox(height: 20,),
],
),
),
Container(
margin: const EdgeInsets.all(12),
alignment: Alignment.bottomCenter,
child: SizedBox(
width: MediaQuery
.of(context)
.size
.width,
child: FlatButton(
height: 48,
color: PaletteColor.primary,
splashColor: PaletteColor.primary80,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3.0),
side: BorderSide(
color: PaletteColor.red,
),
),
onPressed: add,
child: Text(
"Add",
style: TypographyStyle.button1.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
),
],
),
),
),
);
}
add() async {
bool isSucssed = await CreatePrivider.postNasabah(
username : _usernameInput.text,
nama : _namaInput.text,
alamat : _alamatInput.text,
phone : _tlpInput.text,
job : _pekerjaanInput.text,
numberBank : _rekInput.text,
saldo : int.parse(_saldoInput.text.toString()),
password : _passInput.text,
);
if (!isSucssed)
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Text("Gagal"),
);
},
);
else{
showDialog(
context: context,
builder: (context) {
return GestureDetector(
onTap: (){
Navigator.pop(context);
},
child: AlertDialog(
content: Text("Sukses"),
),
);
},
);
}
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/TransactionsPage/PenyetoranPage.dart | import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:simbasa/model/JenisSampah.dart';
import 'package:simbasa/provider/SetoranProvider.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
import 'package:flutter/cupertino.dart';
class PenyetoranPage extends StatefulWidget {
int index = 0;
@override
_PenyetoranPageState createState() => _PenyetoranPageState();
}
class _PenyetoranPageState extends State<PenyetoranPage> {
final TextEditingController _nimInput = new TextEditingController();
List<Widget> _list = [];
String _chosenValue;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Penyetoran",
),
floatingActionButtonLocation: FloatingActionButtonLocation.miniEndDocked,
floatingActionButton: Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FloatingActionButton(
child: Icon(Icons.check),
onPressed: add,
),
SizedBox(width: 10,),
FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
setState(() {
_list.add(_card());
});
},
),
],
),
),
body: Padding(
padding: const EdgeInsets.all(20),
child: Container(
child: Column(
children: [
ListTile(
title: Text(('Masukan Username Nasabah')),
),
TextFormField(
controller: _nimInput,
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'Username',
labelStyle: TextStyle(fontSize: 20),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 8),
child: ListView(
children: [
_card(),
],
)/*.builder(
physics: BouncingScrollPhysics(),
itemCount: _list.length,
itemBuilder: (BuildContext context, int index) {
return _list[index];
},
),*/
),
)
],
),
),
),
);
}
List _dropList = <String>[
'Android',
'IOS',
'Flutter',
'Node',
'Java',
'Python',
'PHP',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList();
Widget _card() {
return FutureBuilder<JenisSampah>(
future:
Provider.of<SetoranProvider>(context, listen: false).getJenisSampah(),
builder: (BuildContext context, snapshot) {
return Card(
child: Column(
children: [
Row(
children: [
Container(
margin: const EdgeInsets.only(left: 12),
alignment: Alignment.centerLeft,
child: DropdownButton<String>(
value: _chosenValue,
//elevation: 5,
style: TextStyle(color: Colors.black),
items: // _dropList,
snapshot.data.data.map((e) => DropdownMenuItem<String>(
value: e.nmSampah,
child: Text(e.nmSampah),
)).toList(),
hint: Text(
"Jenis Sampah",
),
onChanged: (String value) {
setState(() {
_chosenValue = value;
});
},
),
),
Container(
margin: const EdgeInsets.only(left: 12),
alignment: Alignment.centerLeft,
child: TextButton(
onPressed: () {
setState(() {
_list.removeLast();
});
},
child: Text("Delete"),
)),
],
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
labelText: 'Kg',
labelStyle: TextStyle(fontSize: 18),
),
),
),
],
),
);
},
);
}
add() async {
bool isSucssed = await SetoranProvider.postSetoran(
username: _nimInput.text
);
if (!isSucssed)
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Text("Gagal"),
);
},
);
else{
showDialog(
context: context,
builder: (context) {
return GestureDetector(
onTap: (){
Navigator.pop(context);
},
child: AlertDialog(
content: Text("Sukses"),
),
);
},
);
}
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/TransactionsPage/PenarikanPage.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
import 'package:flutter/cupertino.dart';
class PenarikanPage extends StatefulWidget {
@override
_PenarikanPageState createState() => _PenarikanPageState();
}
class _PenarikanPageState extends State<PenarikanPage> {
final TextEditingController _namaInput = new TextEditingController();
final TextEditingController _jumlahInput = new TextEditingController();
// final TextEditingController _kelaminInput = new TextEditingController();
// final TextEditingController _tempatlahirInput = new TextEditingController();
// final TextEditingController _statusInput = new TextEditingController();
// final TextEditingController _pekerjaanInput = new TextEditingController();
// final TextEditingController _tlpInput = new TextEditingController();
// final TextEditingController _rekInput = new TextEditingController();
// final TextEditingController _saldoInput = new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Penarikan",
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
alignment: Alignment.bottomCenter,
child: Column(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
ListTile(
title: Text(('Masukan Nama Anda')),
),
TextFormField(
// validator: (val){
// if (val.length==0){
// return "empty";
// }else{
// return null;
// }
// },
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'nama',
labelStyle: TextStyle(fontSize: 20),
),
controller: _namaInput,
),
SizedBox(height: 20,),
ListTile(
title: Text(('Masukan jumlah yang mau di ambil')),
),
TextFormField(
// style: new TextStyle(color: Colors.white),
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
width: 1.0,
),
),
prefixIcon: Padding(
padding: EdgeInsets.all(0.0),
child: Icon(
Icons.add,
color: Colors.black,
),
),
labelText: 'jumlah yang mau di ambil',
labelStyle: TextStyle(fontSize: 20),
),
controller: _jumlahInput,
),
SizedBox(height: 20,),
],
),
),
Container(
margin: const EdgeInsets.all(12),
alignment: Alignment.bottomCenter,
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: FlatButton(
height: 48,
color: PaletteColor.primary,
splashColor: PaletteColor.primary80,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3.0),
side: BorderSide(
color: PaletteColor.red,
),
),
onPressed: () {},
child: Text(
"tarik sekarang",
style: TypographyStyle.button1.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
),
],
),
),
),
);
}
} | 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/HomePage/HomePage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:simbasa/model/HomePageModel.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/view/DasboardPage/DataListPage/NasabahPage/NasabahPage.dart';
import 'package:simbasa/view/DasboardPage/DataListPage/SetoranPage/SetoranPage.dart';
import 'package:simbasa/view/DasboardPage/component/chart/linecart.dart';
import 'package:simbasa/view/DasboardPage/component/component.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
class HomePage extends StatefulWidget {
final HomePageModel homepage;
const HomePage({@required this.homepage});
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topCenter,
child: Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Hallo, User!",
),
body: Container(
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 8,
left: 12,
right: 12,
),
width: MediaQuery.of(context).size.width,
child: ListTile(
leading: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.deepOrangeAccent,
borderRadius: BorderRadius.circular(5),
),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Dana'),
Text('RP ' + widget.homepage.bank.jmlSimpanan.toString() + ',00'),
],
),
subtitle: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Bank ' + widget.homepage.bank.nmBanksampah),
],
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.only(left: 26, top: 24),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Hari",
style: TextStyle(
shadows: [
Shadow(
color: Colors.deepOrangeAccent,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.deepOrangeAccent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Minggu",
style: TextStyle(
shadows: [
Shadow(
color: Colors.black87,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Bulan",
style: TextStyle(
shadows: [
Shadow(
color: Colors.black87,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Tahun",
style: TextStyle(
shadows: [
Shadow(
color: Colors.black87,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
],
),
),
),
LineChartSample2(),
Container(
padding: const EdgeInsets.only(
left: 18, right: 18, top: 8, bottom: 8),
alignment: Alignment.topCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Report'),
Text('See All'),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8),
child: ListView(
physics: BouncingScrollPhysics(),
children: [
listTile(
subtitle: "Nasabah",
title: widget.homepage.total.toString(),
mini: "5+",
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => NasabahPage(data: widget.homepage,),
),
);
},
),
listTile(
subtitle: "Setoran",
title: widget.homepage.setoran.length.toString(),
mini: "mini",
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SetoranPage(data: widget.homepage,),
),
);
},
),
listTile(
subtitle: "Penarikan",
title: "12",
mini: "mini",
),
listTile(
subtitle: "Penjualan",
title: "12",
mini: "mini",
),
],
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage | mirrored_repositories/simbasa/lib/view/DasboardPage/UserBottomSheetFialog/UserBottomSheetDialog.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/SpacingDimens.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/DasboardPage/UserBottomSheetFialog/component/ConfirmationLogoutDialog.dart';
import 'package:simbasa/view/ProfilePage/ProfilePage.dart';
class UserBottomSheetDialog extends StatelessWidget {
final BuildContext ctx;
UserBottomSheetDialog({@required this.ctx});
@override
Widget build(BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Container(
height: 280.0,
padding: EdgeInsets.symmetric(
horizontal: SpacingDimens.spacing24,
vertical: SpacingDimens.spacing16,
),
color: PaletteColor.primarybg,
child: Column(
children: [
Container(
height: 5,
width: 55,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: PaletteColor.grey60,
),
),
Container(
margin: EdgeInsets.only(
top: SpacingDimens.spacing16,
bottom: SpacingDimens.spacing8,
),
child: Row(
children: [
Container(
height: 65.0,
width: 65.0,
child: CircleAvatar(
backgroundColor: PaletteColor.grey40,
backgroundImage: NetworkImage(
'https://media-exp1.licdn.com/dms/image/C5603AQH-xdswau0QEA/profile-displayphoto-shrink_800_800/0/1618682673767?e=1627516800&v=beta&t=VM3Zeyy9KVvWz5CX-v7Knn-S0bOznGulVdbENAhDbH8'),
),
),
Container(
margin: EdgeInsets.only(
left: SpacingDimens.spacing24,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Text(
"Nur Syahfei",
style: TypographyStyle.subtitle2,
),
),
SizedBox(
height: SpacingDimens.spacing8,
),
Text(
"test",
style: TypographyStyle.subtitle2.merge(
TextStyle(
color: PaletteColor.grey80,
),
),
),
],
),
),
],
),
),
Visibility(
visible: false,
child: Container(
padding: EdgeInsets.only(
top: SpacingDimens.spacing16,
bottom: SpacingDimens.spacing16,
),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: 40,
child: RaisedButton(
elevation: 0,
color: PaletteColor.primary,
onPressed: () {
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
),
),
),
),
),
Container(
height: 1,
width: MediaQuery.of(context).size.width,
color: PaletteColor.primarybg2,
margin: EdgeInsets.only(
top: SpacingDimens.spacing8,
),
),
GestureDetector(
onTap: () {
Navigator.of(ctx).push(
MaterialPageRoute(
builder: (ctx) => ProfilePage(),
),
);
},
child: actionBottomSheet(
icon: Icons.person,
title: "My Profile",
),
),
Container(
height: 1,
width: MediaQuery.of(context).size.width,
color: PaletteColor.primarybg2,
),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return ConfirmationLogoutDialog(
homePageCtx: ctx,
sheetDialogCtx: context,
);
},
);
},
child: actionBottomSheet(
icon: Icons.logout,
title: "Logout",
),
),
Container(
height: 1,
width: MediaQuery.of(context).size.width,
color: PaletteColor.primarybg2,
),
],
),
);
},
);
}
Widget actionBottomSheet({@required IconData icon, @required String title}) {
return Container(
color: PaletteColor.primarybg,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: SpacingDimens.spacing16,
),
child: Row(
children: [
Icon(
icon,
size: 25,
color: PaletteColor.primary,
),
SizedBox(
width: SpacingDimens.spacing24,
),
Text(
title,
style: TypographyStyle.subtitle2,
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage/UserBottomSheetFialog | mirrored_repositories/simbasa/lib/view/DasboardPage/UserBottomSheetFialog/component/ConfirmationLogoutDialog.dart | import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/SpacingDimens.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/SplashScreenPage/SplashscreenPage.dart';
class ConfirmationLogoutDialog extends StatelessWidget {
final BuildContext homePageCtx, sheetDialogCtx;
ConfirmationLogoutDialog(
{@required this.homePageCtx, @required this.sheetDialogCtx});
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
8.0,
),
),
elevation: 0,
backgroundColor: Colors.transparent,
child: contentBox(context),
);
}
contentBox(context) {
return Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(SpacingDimens.spacing24),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: PaletteColor.primarybg,
borderRadius: BorderRadius.circular(4),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Confirmation Logout',
style: TypographyStyle.subtitle1.merge(
TextStyle(
color: PaletteColor.black,
),
),
),
SizedBox(
height: 22,
),
Text(
'Are you sure you want to logout now?',
style: TypographyStyle.paragraph.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
),
SizedBox(
height: 38,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width / 3.2,
child: RaisedButton(
color: PaletteColor.primarybg,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
side: BorderSide(color: PaletteColor.primary),
),
onPressed: () {
Navigator.pop(context);
},
child: Text(
'No',
style: TypographyStyle.button2.merge(
TextStyle(
color: PaletteColor.primary,
),
),
),
),
),
SizedBox(
width: MediaQuery.of(context).size.width / 3.2,
child: RaisedButton(
color: PaletteColor.primary,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
),
onPressed: () {
Navigator.pop(context);
Navigator.pop(sheetDialogCtx);
logOut(homePageCtx);
},
child: Text(
'Yes',
style: TypographyStyle.button2.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
],
),
],
),
),
],
);
}
void logOut(context) async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.clear();
//Provider.of<UserStatusProvider>(context, listen: false).isAsistant = false;
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => SplashScreenPage(),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage | mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage/SetoranPage/SetoranPage.dart | import 'package:flutter/material.dart';
import 'package:simbasa/model/HomePageModel.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/view/DasboardPage/DataListPage/NasabahPage/EditPage/EditPage.dart';
import 'package:simbasa/view/DasboardPage/component/chart/linecart.dart';
import 'package:simbasa/view/DasboardPage/component/component.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
import 'package:intl/intl.dart';
class SetoranPage extends StatefulWidget {
final HomePageModel data;
const SetoranPage({@required this.data});
@override
_SetoranPage createState() => _SetoranPage();
}
class _SetoranPage extends State<SetoranPage> {
bool isChe = false;
bool isChe2 = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(title: "Nasabah"),
body: Container(
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 8,
left: 12,
right: 12,
),
width: MediaQuery.of(context).size.width,
child: ListTile(
leading: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.deepOrangeAccent,
borderRadius: BorderRadius.circular(5),
),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Setoran'),
Text(widget.data.setoran.length.toString()),
],
),
subtitle: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Baru"),
Text(
'+1,6%',
style: TextStyle(color: PaletteColor.green),
),
],
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.only(left: 26, top: 24),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Hari",
style: TextStyle(
shadows: [
Shadow(
color: Colors.deepOrangeAccent,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.deepOrangeAccent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Minggu",
style: TextStyle(
shadows: [
Shadow(color: Colors.black87, offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Bulan",
style: TextStyle(
shadows: [
Shadow(color: Colors.black87, offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Tahun",
style: TextStyle(
shadows: [
Shadow(color: Colors.black87, offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
],
),
),
),
LineChartSample2(),
Container(
padding: const EdgeInsets.only(top: 8, bottom: 8),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 24, right: 8),
child: Text("#"),
),
Align(
alignment: Alignment.bottomLeft,
child: SizedBox(width: 80, child: Text('Nasabah'))),
SizedBox(width: 100, child: Text('Jumlah')),
SizedBox(width: 100, child: Text('Tanggal')),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8),
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: widget.data.setoran.length,
itemBuilder: (BuildContext context, int index) {
return listTile2(
subtitle: widget.data.data.where((element) => element.id == widget.data.setoran[index].nasabahId).first.namaNasabah,
amount: widget.data.setoran[index].totalSetor.toString(),
date: DateFormat('dd-MM-yyyy').format(widget.data.setoran[index].tglSetor),
index: index+1,
onLongPressed: showEdit,
);
},
),
),
),
],
),
),
);
}
void showEdit() async {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => EditPage(ctx: context)),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage | mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage/NasabahPage/NasabahPage.dart | import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:simbasa/model/HomePageModel.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/DasboardPage/DataListPage/NasabahPage/EditPage/EditPage.dart';
import 'package:simbasa/view/DasboardPage/component/chart/linecart.dart';
import 'package:simbasa/view/DasboardPage/component/component.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
class NasabahPage extends StatefulWidget {
final HomePageModel data;
const NasabahPage({@required this.data});
@override
_NasabahPageState createState() => _NasabahPageState();
}
class _NasabahPageState extends State<NasabahPage> {
bool isChe = false;
bool isChe2 = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(title: "Nasabah"),
body: Container(
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 8,
left: 12,
right: 12,
),
width: MediaQuery.of(context).size.width,
child: ListTile(
leading: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.deepOrangeAccent,
borderRadius: BorderRadius.circular(5),
),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Nasabah'),
Text('Baru'),
],
),
subtitle: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('234'),
Text(
'+1,6%',
style: TextStyle(color: PaletteColor.green),
),
],
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.only(left: 26, top: 24),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Hari",
style: TextStyle(
shadows: [
Shadow(
color: Colors.deepOrangeAccent,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.deepOrangeAccent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Minggu",
style: TextStyle(
shadows: [
Shadow(color: Colors.black87, offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Bulan",
style: TextStyle(
shadows: [
Shadow(color: Colors.black87, offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Text(
"Tahun",
style: TextStyle(
shadows: [
Shadow(color: Colors.black87, offset: Offset(0, -5))
],
color: Colors.transparent,
decoration: TextDecoration.underline,
decorationColor: Colors.transparent,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
),
),
),
],
),
),
),
LineChartSample2(),
Container(
padding: const EdgeInsets.only(top: 8, bottom: 8),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 24, right: 8),
child: Text("#"),
),
Align(
alignment: Alignment.bottomLeft,
child: SizedBox(width: 80, child: Text('Name'))),
SizedBox(width: 100, child: Text('Tabungan')),
SizedBox(width: 100, child: Text('Status')),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8),
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: widget.data.total,
itemBuilder: (BuildContext context, int index) {
return listTile2(
subtitle: widget.data.data[index].namaNasabah,
amount: widget.data.data[index].saldo.toString(),
date: DateFormat('dd-MM-yyyy').format(widget.data.data[index].updatedAt),
index: index+1,
onLongPressed: showEdit,
);
},
),
),
),
],
),
),
);
}
void showEdit() async {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => EditPage(ctx: context)),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage/NasabahPage | mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage/NasabahPage/EditPage/EditPage.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/DasboardPage/DataListPage/component/ConfirmationDeleteDialog.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
class EditPage extends StatelessWidget {
final BuildContext ctx;
const EditPage({@required this.ctx});
@override
Widget build(BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Edit Nasabah",
action: [
Padding(
padding: const EdgeInsets.only(right: 12),
child: GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (ctx) =>
ConfirmationDeleteDialog(homePageCtx: ctx),
);
},
child: Icon(
Icons.delete_outline,
color: PaletteColor.grey80,
),
),
)
],
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
alignment: Alignment.bottomCenter,
child: Column(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
children: [
_listTile(
title: "Name",
hitText: "Your name",
),
_listTile(
title: "Address",
hitText: "Enter address",
),
_listTile(
title: "Jenis Kelamin",
hitText: "Enter jenis kelamin",
),
_listTile(
title: "Tempat Lahir",
hitText: "Enter tempat lahir",
),
_listTile(
title: "Tanggal Lahir",
hitText: "Enter tanggal lahir",
),
_listTile(
title: "Status",
hitText: "Enter status hubungan",
),
_listTile(
title: "Pekerjaan",
hitText: "Enter pekerjaan",
),
_listTile(
title: "Tlp",
hitText: "Enter number",
),
_listTile(
title: "No Rekening",
hitText: "Enter no rekening",
),
_listTile(
title: "Saldo",
hitText: "Enter saldo awal",
),
_listTile(
title: "Pekerjaan",
hitText: "Enter pekerjaan",
),
],
),
),
Container(
margin: const EdgeInsets.all(12),
alignment: Alignment.bottomCenter,
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: FlatButton(
height: 48,
color: PaletteColor.primary,
splashColor: PaletteColor.primary80,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3.0),
side: BorderSide(
color: PaletteColor.red,
),
),
onPressed: () {},
child: Text(
"Save",
style: TypographyStyle.button1.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
),
],
),
),
),
);
},
);
}
}
Widget _listTile({String title, String hitText}) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: ListTile(
title: Text(
title,
style: TypographyStyle.caption1.merge(
TextStyle(
fontSize: 14,
color: PaletteColor.grey80,
),
),
),
subtitle: Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: TextFormField(
keyboardType: TextInputType.url,
style: TypographyStyle.button1,
decoration: InputDecoration(
border: InputBorder.none,
hintText: hitText,
contentPadding: EdgeInsets.only(
left: 16,
top: 12,
bottom: 8,
),
hintStyle: TypographyStyle.paragraph.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteColor.primary,
),
),
),
),
),
),
);
}
| 0 |
mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage | mirrored_repositories/simbasa/lib/view/DasboardPage/DataListPage/component/ConfirmationDeleteDialog.dart | import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/SpacingDimens.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/SplashScreenPage/SplashscreenPage.dart';
class ConfirmationDeleteDialog extends StatelessWidget {
final BuildContext homePageCtx;
ConfirmationDeleteDialog(
{@required this.homePageCtx});
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
8.0,
),
),
elevation: 0,
backgroundColor: Colors.transparent,
child: contentBox(context),
);
}
contentBox(context) {
return Stack(
children: [
Container(
width: MediaQuery
.of(context)
.size
.width,
padding: EdgeInsets.all(SpacingDimens.spacing24),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: PaletteColor.primarybg,
borderRadius: BorderRadius.circular(4),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Confirmation Delete',
style: TypographyStyle.subtitle1.merge(
TextStyle(
color: PaletteColor.black,
),
),
),
SizedBox(
height: 22,
),
Text(
'Are you sure you want to delete?',
style: TypographyStyle.paragraph.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
),
SizedBox(
height: 38,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery
.of(context)
.size
.width / 3.2,
child: RaisedButton(
color: PaletteColor.primarybg,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
side: BorderSide(color: PaletteColor.primary),
),
onPressed: () {
Navigator.pop(context);
},
child: Text(
'No',
style: TypographyStyle.button2.merge(
TextStyle(
color: PaletteColor.primary,
),
),
),
),
),
SizedBox(
width: MediaQuery
.of(context)
.size
.width / 3.2,
child: RaisedButton(
color: PaletteColor.primary,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
),
onPressed: () {},
child: Text(
'Yes',
style: TypographyStyle.button2.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
],
),
],
),
),
],
);
}
} | 0 |
mirrored_repositories/simbasa/lib/view | mirrored_repositories/simbasa/lib/view/LoginPage/LoginPage.dart | import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simbasa/config/GlobalKeySharedPref.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/DasboardPage/DashboardPage.dart';
import 'package:simbasa/view/LoginPage/component/AuthLogin.dart';
import 'package:simbasa/view/LoginPage/component/ButtonLogin.dart';
import 'package:simbasa/view/LoginPage/component/MainForms.dart';
import 'package:simbasa/view/component/Indicator/IndicatorLoad.dart';
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final TextEditingController _nimController = new TextEditingController();
final TextEditingController _passwordController = new TextEditingController();
bool isLoading = false;
@override
Widget build(BuildContext context) {
Widget loadingIndicator = isLoading
? Container(
color: Colors.black26,
width: double.infinity,
height: double.infinity,
child: indicatorLoad(),
)
: Container();
return Scaffold(
backgroundColor: PaletteColor.primarybg,
body: Stack(
children: [
SafeArea(
child: Center(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(24),
child: Column(
children: [
Container(
child: Image.asset(
'assets/images/simbasaLogo2.png',
width: 230,
),
),
MainForms(
nimFilter: _nimController,
passwordFilter: _passwordController,
),
Container(
alignment: Alignment.topRight,
padding: EdgeInsets.only(top: 16),
child: GestureDetector(
onTap: () {},
child: Text(
"Forgot password?",
style: TypographyStyle.caption2.merge(
TextStyle(
color: PaletteColor.primary,
),
),
),
),
),
ButtonLogin(
onPressedFunction,
),
],
),
),
),
),
),
Align(
child: loadingIndicator,
alignment: FractionalOffset.center,
),
],
),
);
}
savePrefFungsion(String nama) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool(GlobalKeySharedPref.keyPrefIsLogin, true);
prefs.setString(GlobalKeySharedPref.keyPrefUsername, _nimController.text);
}
void onPressedFunction() async {
setState(() {
isLoading = true;
});
bool isLogin = await AuthLogin.auth(username: _nimController.text, password: _passwordController.text);
setState(() {
isLoading = false;
});
if (isLogin) {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => DashboardPage(
username: " ", //element["UserName"],
),
),
);
//savePrefFungsion(element["FullName"]);
}
//});
if (!isLogin)
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Text("Username or Password is Wrong"),
);
},
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/LoginPage | mirrored_repositories/simbasa/lib/view/LoginPage/component/AuthLogin.dart |
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
class AuthLogin{
static auth({@required String username, @required String password}) async{
SharedPreferences pref = await SharedPreferences.getInstance();
try {
final response = await http.post(Uri.http('192.168.1.9:8001', '/api/v1/auth/login'), body: {
"email" : username,
"password" : password
});
print("reponse : " + response.body);
Map<String, dynamic> data = jsonDecode(response.body);
if(data["access_token"] != null){
pref.setString("auth_token", data["access_token"]);
pref.setBool("is_login", true);
return true;
}
return false;
} catch (e) {
print(e);
return false;
}
}
} | 0 |
mirrored_repositories/simbasa/lib/view/LoginPage | mirrored_repositories/simbasa/lib/view/LoginPage/component/MainForms.dart | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:simbasa/theme/PaletteColor.dart';import 'package:simbasa/theme/TypographyStyle.dart';class MainForms extends StatefulWidget {
final TextEditingController nimFilter;
final TextEditingController passwordFilter;
MainForms({@required this.nimFilter, @required this.passwordFilter});
@override
_MainFormsState createState() => _MainFormsState();
}
class _MainFormsState extends State<MainForms> {
bool _isHidePassword = true;
void _togglePasswordVisibility() {
setState(() {
_isHidePassword = !_isHidePassword;
});
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 44),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
alignment: Alignment.bottomLeft,
child: Text(
"Username",
style: TypographyStyle.mini.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
),
),
TextFormField(
controller: widget.nimFilter,
cursorColor: PaletteColor.primary,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: 16,
top: 8,
bottom: 8,
),
hintText: "Enter email",
hintStyle: TypographyStyle.paragraph.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteColor.primary,
),
),
),
),
Container(
margin: EdgeInsets.only(top: 36),
alignment: Alignment.bottomLeft,
child: Text(
"Password",
style: TypographyStyle.mini.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
),
),
TextFormField(
obscureText: _isHidePassword,
controller: widget.passwordFilter,
cursorColor: PaletteColor.primary,
keyboardType: TextInputType.visiblePassword,
style: TypographyStyle.button1,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: 16,
top: 12,
bottom: 8,
),
hintText: "Enter Password",
hintStyle: TypographyStyle.paragraph.merge(
TextStyle(
color: PaletteColor.grey60,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteColor.primary,
),
),
suffixIcon: GestureDetector(
onTap: _togglePasswordVisibility,
child: Icon(
_isHidePassword ? Icons.visibility_off : Icons.visibility,
color: _isHidePassword
? PaletteColor.grey60
: PaletteColor.primary,
),
),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/LoginPage | mirrored_repositories/simbasa/lib/view/LoginPage/component/ButtonLogin.dart |
import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
class ButtonLogin extends StatelessWidget {
final onPressedFunction;
const ButtonLogin(this.onPressedFunction);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 24),
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: FlatButton(
color: PaletteColor.primary,
splashColor: PaletteColor.primary80,
height: 48,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3.0),
side: BorderSide(
color: PaletteColor.red,
),
),
onPressed: this.onPressedFunction,
child: Text(
"Login",
style: TypographyStyle.button1.merge(
TextStyle(
color: PaletteColor.primarybg,
),
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view | mirrored_repositories/simbasa/lib/view/SplashScreenPage/SplashscreenPage.dart | import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simbasa/config/GlobalKeySharedPref.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/view/DasboardPage/DashboardPage.dart';
import 'package:simbasa/view/LoginPage/LoginPage.dart';
import 'package:simbasa/view/component/Indicator/IndicatorLoad.dart';
class SplashScreenPage extends StatefulWidget {
@override
_SplashScreenPageState createState() => _SplashScreenPageState();
}
class _SplashScreenPageState extends State<SplashScreenPage> {
startTime() async {
var _duration = new Duration(seconds: 3);
return Timer(_duration, navigationPage);
}
navigationPage() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
bool isHasLogined =
prefs.getBool(GlobalKeySharedPref.keyPrefIsLogin) ?? false;
String username = prefs.getString(GlobalKeySharedPref.keyPrefUsername);
print(username);
if (isHasLogined) {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => DashboardPage(username: username),
),
);
} else {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => LoginPage(),
),
);
}
print(isHasLogined);
return isHasLogined;
}
@override
void initState() {
//SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
startTime();
super.initState();
}
// @override
// void dispose() {
// SystemChrome.setEnabledSystemUIOverlays(
// [SystemUiOverlay.top, SystemUiOverlay.bottom]);
// super.dispose();
// }
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg,
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
"assets/images/simbasaLogo.png",
height: 130,
),
),
indicatorLoad(),
],
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib/view/component | mirrored_repositories/simbasa/lib/view/component/appbar/appbar.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
AppBar appbar({@required String title, List<Widget> action}) {
return AppBar(
backgroundColor: PaletteColor.primarybg2,
iconTheme: IconThemeData(
color: Colors.black, //change your color here
),
title: Text(
title,
style: TypographyStyle.title.merge(
TextStyle(
fontSize: 18,
),
),
),
actions: action,
elevation: 0,
);
}
| 0 |
mirrored_repositories/simbasa/lib/view/component | mirrored_repositories/simbasa/lib/view/component/Indicator/IndicatorLoad.dart | import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:simbasa/theme/PaletteColor.dart';
Widget indicatorLoad() {
return SpinKitFadingCircle(
size: 45,
itemBuilder: (BuildContext context, int index) {
return DecoratedBox(
decoration: BoxDecoration(
color: PaletteColor.primary,
shape: BoxShape.circle,
),
);
},
);
}
| 0 |
mirrored_repositories/simbasa/lib/view | mirrored_repositories/simbasa/lib/view/ProfilePage/ProfilePage.dart | import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
import 'package:simbasa/theme/TypographyStyle.dart';
import 'package:simbasa/view/component/appbar/appbar.dart';
class ProfilePage extends StatefulWidget {
@override
_ProfilePageState createState() => _ProfilePageState();
}
class _ProfilePageState extends State<ProfilePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: PaletteColor.primarybg2,
appBar: appbar(
title: "Profile",
),
body: Column(
children: [
Container(
height: 230,
alignment: Alignment.center,
decoration: BoxDecoration(
color: PaletteColor.primarybg2,
boxShadow: <BoxShadow>[
BoxShadow(
spreadRadius: 0, color: PaletteColor.grey60, blurRadius: 1),
],
),
child: Container(
height: 200,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
CircleAvatar(
radius: MediaQuery.of(context).size.height / 13,
backgroundImage: NetworkImage(
'https://media-exp1.licdn.com/dms/image/C5603AQH-xdswau0QEA/profile-displayphoto-shrink_800_800/0/1618682673767?e=1627516800&v=beta&t=VM3Zeyy9KVvWz5CX-v7Knn-S0bOznGulVdbENAhDbH8'),
),
Container(
padding: const EdgeInsets.only(bottom: 2, top: 8),
child: Text(
"Nur Syahfei",
style: TypographyStyle.subtitle1,
),
),
Container(
padding: const EdgeInsets.only(bottom: 8),
child: Card(
color: Colors.deepOrangeAccent,
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
"Pemilik",
style: TypographyStyle.caption1.merge(TextStyle(
fontSize: 12,
color: PaletteColor.grey,
)),
),
),
),
),
],
),
),
),
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
children: [
SizedBox(height: 8,),
_listTile(title: 'Name', subtitle: "Nur Syahfei"),
Divider(),
_listTile(title: 'Address', subtitle: "Nur Syahfei"),
Divider(),
_listTile(title: 'Headphone', subtitle: "Nur Syahfei"),
],
),
),
],
),
);
}
Padding _listTile({@required String title, @required subtitle}){
return Padding(
padding: const EdgeInsets.all(2),
child: ListTile(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(title, style: TypographyStyle.caption1.merge(TextStyle(color: PaletteColor.grey60)),),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(subtitle),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/config/GlobalKeySharedPref.dart | class GlobalKeySharedPref {
// Random Key
static String keyPref = "Simbasa45-";
static String keyPrefIsLogin = keyPref + "LOGIN";
static String keyPrefUsername = keyPref + "USERNAME";
// Secure Key Cookie
static String secureKeyCookie = "__api-auth-q";
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/model/HomePageModel.dart | // To parse this JSON data, do
//
// final homePageModel = homePageModelFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
HomePageModel homePageModelFromJson(String str) => HomePageModel.fromJson(json.decode(str));
String homePageModelToJson(HomePageModel data) => json.encode(data.toJson());
class HomePageModel {
HomePageModel({
@required this.total,
@required this.messages,
@required this.chart,
@required this.bank,
@required this.data,
@required this.setoran,
});
final int total;
final String messages;
final Chart chart;
final Bank bank;
final List<Datum> data;
final List<Setoran> setoran;
factory HomePageModel.fromJson(Map<String, dynamic> json) => HomePageModel(
total: json["total"] == null ? null : json["total"],
messages: json["messages"] == null ? null : json["messages"],
chart: json["chart"] == null ? null : Chart.fromJson(json["chart"]),
bank: json["bank"] == null ? null : Bank.fromJson(json["bank"]),
data: json["data"] == null ? null : List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
setoran: json["setoran"] == null ? null : List<Setoran>.from(json["setoran"].map((x) => Setoran.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"total": total == null ? null : total,
"messages": messages == null ? null : messages,
"chart": chart == null ? null : chart.toJson(),
"bank": bank == null ? null : bank.toJson(),
"data": data == null ? null : List<dynamic>.from(data.map((x) => x.toJson())),
"setoran": setoran == null ? null : List<dynamic>.from(setoran.map((x) => x.toJson())),
};
}
class Bank {
Bank({
@required this.id,
@required this.nmBanksampah,
@required this.almtBanksampah,
@required this.telp,
@required this.tglBerdiri,
@required this.jenisSampah,
@required this.nmPenggurus,
@required this.jmlKaryawan,
@required this.jmlNasabah,
@required this.jmlSimpanan,
@required this.email,
@required this.kelurahanId,
@required this.createdAt,
@required this.updatedAt,
@required this.deletedAt,
});
final int id;
final String nmBanksampah;
final String almtBanksampah;
final String telp;
final DateTime tglBerdiri;
final String jenisSampah;
final String nmPenggurus;
final int jmlKaryawan;
final int jmlNasabah;
final int jmlSimpanan;
final String email;
final int kelurahanId;
final dynamic createdAt;
final dynamic updatedAt;
final dynamic deletedAt;
factory Bank.fromJson(Map<String, dynamic> json) => Bank(
id: json["id"] == null ? null : json["id"],
nmBanksampah: json["nm_banksampah"] == null ? null : json["nm_banksampah"],
almtBanksampah: json["almt_banksampah"] == null ? null : json["almt_banksampah"],
telp: json["telp"] == null ? null : json["telp"],
tglBerdiri: json["tgl_berdiri"] == null ? null : DateTime.parse(json["tgl_berdiri"]),
jenisSampah: json["jenis_sampah"] == null ? null : json["jenis_sampah"],
nmPenggurus: json["nm_penggurus"] == null ? null : json["nm_penggurus"],
jmlKaryawan: json["jml_karyawan"] == null ? null : json["jml_karyawan"],
jmlNasabah: json["jml_nasabah"] == null ? null : json["jml_nasabah"],
jmlSimpanan: json["jml_simpanan"] == null ? null : json["jml_simpanan"],
email: json["email"] == null ? null : json["email"],
kelurahanId: json["kelurahan_id"] == null ? null : json["kelurahan_id"],
createdAt: json["created_at"],
updatedAt: json["updated_at"],
deletedAt: json["deleted_at"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"nm_banksampah": nmBanksampah == null ? null : nmBanksampah,
"almt_banksampah": almtBanksampah == null ? null : almtBanksampah,
"telp": telp == null ? null : telp,
"tgl_berdiri": tglBerdiri == null ? null : tglBerdiri.toIso8601String(),
"jenis_sampah": jenisSampah == null ? null : jenisSampah,
"nm_penggurus": nmPenggurus == null ? null : nmPenggurus,
"jml_karyawan": jmlKaryawan == null ? null : jmlKaryawan,
"jml_nasabah": jmlNasabah == null ? null : jmlNasabah,
"jml_simpanan": jmlSimpanan == null ? null : jmlSimpanan,
"email": email == null ? null : email,
"kelurahan_id": kelurahanId == null ? null : kelurahanId,
"created_at": createdAt,
"updated_at": updatedAt,
"deleted_at": deletedAt,
};
}
class Chart {
Chart({
@required this.spot1,
@required this.spot2,
@required this.spot3,
@required this.spot4,
@required this.spot5,
@required this.spot6,
@required this.spot7,
});
final int spot1;
final int spot2;
final int spot3;
final int spot4;
final int spot5;
final int spot6;
final int spot7;
factory Chart.fromJson(Map<String, dynamic> json) => Chart(
spot1: json["spot1"] == null ? null : json["spot1"],
spot2: json["spot2"] == null ? null : json["spot2"],
spot3: json["spot3"] == null ? null : json["spot3"],
spot4: json["spot4"] == null ? null : json["spot4"],
spot5: json["spot5"] == null ? null : json["spot5"],
spot6: json["spot6"] == null ? null : json["spot6"],
spot7: json["spot7"] == null ? null : json["spot7"],
);
Map<String, dynamic> toJson() => {
"spot1": spot1 == null ? null : spot1,
"spot2": spot2 == null ? null : spot2,
"spot3": spot3 == null ? null : spot3,
"spot4": spot4 == null ? null : spot4,
"spot5": spot5 == null ? null : spot5,
"spot6": spot6 == null ? null : spot6,
"spot7": spot7 == null ? null : spot7,
};
}
class Datum {
Datum({
@required this.id,
@required this.namaNasabah,
@required this.username,
@required this.almtNasabah,
@required this.noHp,
@required this.jenisKelamin,
@required this.tmptLahir,
@required this.tglLahir,
@required this.status,
@required this.agama,
@required this.pekerjaan,
@required this.noRekening,
@required this.saldo,
@required this.password,
@required this.kelurahanId,
@required this.createdAt,
@required this.updatedAt,
@required this.deletedAt,
});
final int id;
final String namaNasabah;
final String username;
final String almtNasabah;
final String noHp;
final int jenisKelamin;
final String tmptLahir;
final String tglLahir;
final String status;
final String agama;
final String pekerjaan;
final int noRekening;
final int saldo;
final String password;
final int kelurahanId;
final DateTime createdAt;
final DateTime updatedAt;
final dynamic deletedAt;
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"] == null ? null : json["id"],
namaNasabah: json["nama_nasabah"] == null ? null : json["nama_nasabah"],
username: json["username"] == null ? null : json["username"],
almtNasabah: json["almt_nasabah"] == null ? null : json["almt_nasabah"],
noHp: json["no_hp"] == null ? null : json["no_hp"],
jenisKelamin: json["jenis_kelamin"] == null ? null : json["jenis_kelamin"],
tmptLahir: json["tmpt_lahir"] == null ? null : json["tmpt_lahir"],
tglLahir: json["tgl_lahir"] == null ? null : json["tgl_lahir"],
status: json["status"] == null ? null : json["status"],
agama: json["agama"] == null ? null : json["agama"],
pekerjaan: json["pekerjaan"] == null ? null : json["pekerjaan"],
noRekening: json["no_rekening"] == null ? null : json["no_rekening"],
saldo: json["saldo"] == null ? null : json["saldo"],
password: json["password"] == null ? null : json["password"],
kelurahanId: json["kelurahan_id"] == null ? null : json["kelurahan_id"],
createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
updatedAt: json["updated_at"] == null ? null : DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"nama_nasabah": namaNasabah == null ? null : namaNasabah,
"username": username == null ? null : username,
"almt_nasabah": almtNasabah == null ? null : almtNasabah,
"no_hp": noHp == null ? null : noHp,
"jenis_kelamin": jenisKelamin == null ? null : jenisKelamin,
"tmpt_lahir": tmptLahir == null ? null : tmptLahir,
"tgl_lahir": tglLahir == null ? null : tglLahir,
"status": status == null ? null : status,
"agama": agama == null ? null : agama,
"pekerjaan": pekerjaan == null ? null : pekerjaan,
"no_rekening": noRekening == null ? null : noRekening,
"saldo": saldo == null ? null : saldo,
"password": password == null ? null : password,
"kelurahan_id": kelurahanId == null ? null : kelurahanId,
"created_at": createdAt == null ? null : createdAt.toIso8601String(),
"updated_at": updatedAt == null ? null : updatedAt.toIso8601String(),
"deleted_at": deletedAt,
};
}
class Setoran {
Setoran({
@required this.id,
@required this.tglSetor,
@required this.totalSetor,
@required this.nasabahId,
@required this.createdAt,
@required this.updatedAt,
@required this.deletedAt,
});
final int id;
final DateTime tglSetor;
final int totalSetor;
final int nasabahId;
final DateTime createdAt;
final DateTime updatedAt;
final dynamic deletedAt;
factory Setoran.fromJson(Map<String, dynamic> json) => Setoran(
id: json["id"] == null ? null : json["id"],
tglSetor: json["tgl_setor"] == null ? null : DateTime.parse(json["tgl_setor"]),
totalSetor: json["total_setor"] == null ? null : json["total_setor"],
nasabahId: json["nasabah_id"] == null ? null : json["nasabah_id"],
createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
updatedAt: json["updated_at"] == null ? null : DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"tgl_setor": tglSetor == null ? null : tglSetor.toIso8601String(),
"total_setor": totalSetor == null ? null : totalSetor,
"nasabah_id": nasabahId == null ? null : nasabahId,
"created_at": createdAt == null ? null : createdAt.toIso8601String(),
"updated_at": updatedAt == null ? null : updatedAt.toIso8601String(),
"deleted_at": deletedAt,
};
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/model/JenisSampah.dart | // To parse this JSON data, do
//
// final jenisSampah = jenisSampahFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
JenisSampah jenisSampahFromJson(String str) => JenisSampah.fromJson(json.decode(str));
String jenisSampahToJson(JenisSampah data) => json.encode(data.toJson());
class JenisSampah {
JenisSampah({
@required this.total,
@required this.messages,
@required this.data,
});
final int total;
final String messages;
final List<Datum> data;
factory JenisSampah.fromJson(Map<String, dynamic> json) => JenisSampah(
total: json["total"] == null ? null : json["total"],
messages: json["messages"] == null ? null : json["messages"],
data: json["data"] == null ? null : List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"total": total == null ? null : total,
"messages": messages == null ? null : messages,
"data": data == null ? null : List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Datum {
Datum({
@required this.id,
@required this.nmSampah,
@required this.satuan,
@required this.hrgJual,
@required this.hrgBeli,
@required this.stock,
@required this.kategoriId,
@required this.createdAt,
@required this.updatedAt,
@required this.deletedAt,
});
final int id;
final String nmSampah;
final String satuan;
final int hrgJual;
final int hrgBeli;
final int stock;
final int kategoriId;
final dynamic createdAt;
final dynamic updatedAt;
final dynamic deletedAt;
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"] == null ? null : json["id"],
nmSampah: json["nm_sampah"] == null ? null : json["nm_sampah"],
satuan: json["satuan"] == null ? null : json["satuan"],
hrgJual: json["hrg_jual"] == null ? null : json["hrg_jual"],
hrgBeli: json["hrg_beli"] == null ? null : json["hrg_beli"],
stock: json["stock"] == null ? null : json["stock"],
kategoriId: json["kategori_id"] == null ? null : json["kategori_id"],
createdAt: json["created_at"],
updatedAt: json["updated_at"],
deletedAt: json["deleted_at"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"nm_sampah": nmSampah == null ? null : nmSampah,
"satuan": satuan == null ? null : satuan,
"hrg_jual": hrgJual == null ? null : hrgJual,
"hrg_beli": hrgBeli == null ? null : hrgBeli,
"stock": stock == null ? null : stock,
"kategori_id": kategoriId == null ? null : kategoriId,
"created_at": createdAt,
"updated_at": updatedAt,
"deleted_at": deletedAt,
};
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/theme/PaletteColor.dart | import 'package:flutter/material.dart';
class PaletteColor {
static const Color black = Colors.black;
/* Primary Color */
static const Color primary = Color(0xFFFF5B16);
static const Color primary80 = Color(0xFFFF704B);
static const Color primary60 = Color(0xFFFF9796);
static const Color primary40 = Color(0xFFFFE0E0);
/* Primary Background */
static const Color primarybg = Color(0xFFFFFFFF);
static const Color primarybg2 = Color(0xFFF5F6F8);
/* Grey Color */
static const Color text = Color(0xFF262626);
static const Color grey = Color(0xFF1A1A1A);
static const Color grey80 = Color(0xFF5D5D5D);
static const Color grey60 = Color(0xFFA0A0A0);
static const Color grey40 = Color(0xFFE4E4E4);
/* Semantic Color */
static const Color red = Color(0xFFFF3B30);
static const Color yellow = Color(0xFFFFD800);
static const Color green = Color(0xFF26D07C);
static const Color blue = Color(0xFF0F8CFF);
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/theme/TypographyStyle.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:simbasa/theme/PaletteColor.dart';
class TypographyStyle {
/* HEADING */
static const TextStyle heading1 = TextStyle(
fontSize: 28,
fontWeight: FontWeight.w700,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
static const TextStyle title = TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
static const TextStyle subtitle1 = TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
static const TextStyle subtitle2 = TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
/* BODY */
static const TextStyle paragraph = TextStyle(
fontSize: 14,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
static const TextStyle caption1 = TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
color: PaletteColor.grey,
fontFamily: 'Mulish',
);
static const TextStyle caption2 = TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
static const TextStyle mini = TextStyle(
fontSize: 10,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
/* BUTTON */
static const TextStyle button1 = TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
static const TextStyle button2 = TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: PaletteColor.text,
fontFamily: 'Mulish',
);
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/theme/SpacingDimens.dart | class SpacingDimens {
static const spacing4 = 4.0;
static const spacing8 = spacing4 * 2;
static const spacing12 = spacing4 * 3;
static const spacing16 = spacing4 * 4;
static const spacing24 = spacing4 * 6;
static const spacing28 = spacing4 * 7;
static const spacing32 = spacing4 * 8;
static const spacing36 = spacing4 * 9;
static const spacing40 = spacing4 * 10;
static const spacing44 = spacing4 * 11;
static const spacing48 = spacing4 * 12;
static const spacing52 = spacing4 * 13;
static const spacing64 = spacing4 * 16;
static const spacing88 = spacing4 * 22;
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/provider/SetoranProvider.dart | import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simbasa/model/JenisSampah.dart';
import 'package:http/http.dart' as http;
class SetoranProvider extends ChangeNotifier {
Future<JenisSampah> getJenisSampah() async {
SharedPreferences pref = await SharedPreferences.getInstance();
String token = pref.getString('auth_token');
try {
//final response = await http.get(Uri.http('127.0.0.1:8000', '/api/v1/consoles/all'), headers: {});
final response = await http.get(
Uri.http('192.168.1.9:8001', '/api/v1/jenis'),
headers: {'Authorization': 'Bearer $token'});
return jenisSampahFromJson(response.body);
} catch (e) {
print(e);
return null;
}
}
static Future<bool> postSetoran({
username,
jumlah,
sampah_id,
jenis_id,
sub_total,
total,
kg,
}) async {
SharedPreferences pref = await SharedPreferences.getInstance();
String token = pref.getString('auth_token');
try {
//final response = await http.get(Uri.http('127.0.0.1:8000', '/api/v1/consoles/all'), headers: {});
final response = await http.post(
Uri.http('192.168.1.9:8001', '/api/v1/setoran/create'),
headers: {'Authorization': 'Bearer $token'},
body: {
"username": "$username",
"jumlah": "$jumlah",
"sampah_id": "$sampah_id",
"jenis_id": "$jenis_id",
"sub_total": "$sub_total",
"total": "$total",
"kg": "$kg",
},
);
print(response.body);
if (response.statusCode != 200) return false;
return true;
} catch (e) {
print(e);
return null;
}
}
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/provider/CreateProvider.dart | import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
class CreatePrivider {
static Future<bool> postNasabah({
String username,
String nama,
String alamat,
String phone,
String job,
String numberBank,
int saldo,
String password,
}) async {
SharedPreferences pref = await SharedPreferences.getInstance();
String token = pref.getString('auth_token');
try {
//final response = await http.get(Uri.http('127.0.0.1:8000', '/api/v1/consoles/all'), headers: {});
final response = await http.post(
Uri.http('192.168.1.9:8001', '/api/v1/nasabah/create'),
headers: {
'Authorization': 'Bearer $token'
},
body: {
"username": "$username",
"nama_nasabah": "$nama",
"almt_nasabah": "$alamat",
"no_hp": "$phone",
"pekerjaan": "$job",
"no_rekening": "$numberBank",
"saldo": "$saldo",
"password": "$password"
});
print("reponse : " + response.body);
if(response.statusCode != 200) return false;
return true;
} catch (e) {
print(e);
return false;
}
}
}
| 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/provider/Auth.dart |
class Auth{
Future<bool> auth() async{
}
} | 0 |
mirrored_repositories/simbasa/lib | mirrored_repositories/simbasa/lib/provider/HomaPageProvider.dart |
import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
import 'package:simbasa/model/HomePageModel.dart';
class HomePageProvider extends ChangeNotifier{
Future<HomePageModel> getHomePageData() async{
SharedPreferences pref = await SharedPreferences.getInstance();
String token = pref.getString('auth_token');
try {
//final response = await http.get(Uri.http('127.0.0.1:8000', '/api/v1/consoles/all'), headers: {});
final response = await http.get(Uri.http('192.168.1.9:8001', '/api/v1/homepage'), headers : {
'Authorization': 'Bearer $token'
});
return homePageModelFromJson(response.body);
} catch (e) {
print(e);
return null;
}
}
} | 0 |
mirrored_repositories/simbasa | mirrored_repositories/simbasa/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 that Flutter provides. 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:simbasa/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/quran | mirrored_repositories/quran/lib/main.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quran/tools/appconfig.dart';
import 'package:quran/tools/myThemeData.dart';
import 'package:quran/singleNavbarPages/navbar.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (BuildContext)=>appConfig(),///class name
builder: (BuildContext,Widget){
final provider=Provider.of<appConfig>(BuildContext);
return MaterialApp(
themeMode: provider.themeMode,
darkTheme:MythemeData.darkTheme,
theme:MythemeData.lightTheme,
localizationsDelegates: [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
locale: Locale.fromSubtags(languageCode: provider.currentLanguage),
debugShowCheckedModeBanner: false,
home:navbar()
);
},
);
}
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/singleNavbarPages/Setting.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:quran/tools/appconfig.dart';
class Setting extends StatefulWidget {
const Setting({Key? key}) : super(key: key);
@override
_SettingState createState() => _SettingState();
}
class _SettingState extends State<Setting> {
late appConfig provider ; //= Provider.of<appConfig>();
void LanguageMenu()
{
showModalBottomSheet(
context: context,
builder: (buildContext){
return Container(
color: Theme.of(context).secondaryHeaderColor,
child:Column(
children: [
Container(
margin: EdgeInsets.only(top: 20,bottom: 20),
child: Material(
color: Colors.white.withOpacity(0.0),
child: InkWell(
onTap: (){
provider.changeLanguage('ar');
},
child: Container(
color: Colors.transparent,
child: Text('العربية',style: TextStyle(fontSize: 32,color: provider.isEnglish()? Theme.of(context).primaryColor:Colors.red,fontFamily: 'ElMessiri'),),
),
),
),
),
Container(
//margin: EdgeInsets.only(top: 140,bottom: 80),
child: Material(
color: Colors.white.withOpacity(0.0),
child: InkWell(
onTap: (){
provider.changeLanguage('en');
},
child: Container(
color: Colors.transparent,
child: Text('English',style: TextStyle(fontSize: 32,color: provider.isEnglish()? Colors.red :Theme.of(context).primaryColor,fontFamily: 'ElMessiri'),),
),
),
),
),
],
)
);
});
}
void themeMenu()
{
showModalBottomSheet(
context: context,
builder: (buildContext){
return Container(
color: Theme.of(context).secondaryHeaderColor,
child:Column(
children: [
Container(
margin: EdgeInsets.only(top: 20,bottom: 20),
child: Material(
color: Colors.white.withOpacity(0.0),
child: InkWell(
onTap: (){
provider.toggleTheme();
},
child: Container(
color: Colors.transparent,
child: Text(AppLocalizations.of(context)!.light,style: TextStyle(fontSize: 32,color: provider.isDarkMode()? Theme.of(context).primaryColor:Colors.red,fontFamily: 'ElMessiri'),),
),
),
),
),
Container(
//margin: EdgeInsets.only(top: 140,bottom: 80),
child: Material(
color: Colors.white.withOpacity(0.0),
child: InkWell(
onTap: (){
provider.toggleTheme();
},
child: Container(
color: Colors.transparent,
child: Text(AppLocalizations.of(context)!.dark,style: TextStyle(fontSize: 32,color: provider.isDarkMode()? Colors.red:Theme.of(context).primaryColor,fontFamily: 'ElMessiri'),),
),
),
),
),
],
)
);
});
}
@override
Widget build(BuildContext context) {
provider=Provider.of<appConfig>(context);
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill)
)
,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
padding: EdgeInsets.only(top: 10,bottom: 10),
margin: EdgeInsets.only(top: 160),
color: provider.isDarkMode()==true ?Colors.black12 :Colors.white60,
child: Material(
color: Colors.white.withOpacity(0.0),
child: InkWell(
onTap: (){
LanguageMenu();
},
child: Container(
color: Colors.transparent,
child: Text(AppLocalizations.of(context)!.language,style: TextStyle(fontSize: 30,color:Theme.of(context).primaryColor),textAlign: TextAlign.center,),
),
),
),
)
,
Container(
padding: EdgeInsets.only(top: 10,bottom: 10),
margin: EdgeInsets.only(top: 20,),
color: provider.isDarkMode()==true ?Colors.black12 :Colors.white60,
child: Material(
color: Colors.white.withOpacity(0.0),
child: InkWell(
onTap: (){
themeMenu();
},
child: Container(
width: double.infinity,
color: Colors.transparent,
child: Text(AppLocalizations.of(context)!.theme,style: TextStyle(fontSize: 30,color:Theme.of(context).primaryColor),textAlign: TextAlign.center,),
),
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/singleNavbarPages/navbar.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:quran/Ahadeeth/AhadeethMenu.dart';
import 'package:quran/singleNavbarPages/Setting.dart';
import '../Surah/ListOfSurahNames.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'Sebha.dart';
import 'package:quran/Radio/RadioPage.dart';
import '../tools/appconfig.dart';
class navbar extends StatefulWidget {
@override
navbarState createState() => navbarState();
}
late appConfig provider;
class navbarState extends State<navbar> {
int selected=0;
void IconTap(int index)
{
setState(() {
selected=index;
});
}
tempPages()
{
provider = Provider.of<appConfig>(context);
return Container(
//constraints: BoxConstraints.expand(),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill)
));
}
@override
Widget build(BuildContext context) {
List<Widget> _pages = <Widget>[
Setting(),
RadioPage(),
Sebha(),
AhadeethMenu(),
ListOfSurahNames(),
];
return Scaffold(
body: Center(
child: _pages.elementAt(selected), //New
),
bottomNavigationBar:BottomNavigationBar(
type: BottomNavigationBarType.fixed,
backgroundColor: Theme.of(context).bottomAppBarColor,
iconSize: 10,
items: [
BottomNavigationBarItem(
activeIcon: new SizedBox(height: 30,child: Image.asset('assets/icons/setting.png',color: Theme.of(context).accentColor,),),
icon: new SizedBox(height:20 ,child: Image.asset('assets/icons/setting.png'),),
label: AppLocalizations.of(context)!.settings,
),
BottomNavigationBarItem(
activeIcon: new SizedBox(height: 30,child: Image.asset('assets/icons/radio_blue.png',color:Theme.of(context).accentColor,),),
icon: new SizedBox(height:20 ,child: Image.asset('assets/icons/radio_blue.png'),),
label: AppLocalizations.of(context)!.radio,
),
BottomNavigationBarItem(
activeIcon: new SizedBox(height: 30,child: Image.asset('assets/icons/sebha_blue.png',color: Theme.of(context).accentColor,),),
icon:new SizedBox(height: 20,child: Image.asset('assets/icons/sebha_blue.png'),),
label: AppLocalizations.of(context)!.tasbeeh,
),
BottomNavigationBarItem(
activeIcon: new SizedBox(height: 30,child: Image.asset('assets/icons/Group 6.png',color:Theme.of(context).accentColor,),),
icon: new SizedBox(height:20 ,child: Image.asset('assets/icons/Group 6.png'),),
label: AppLocalizations.of(context)!.hadeeth,
),
BottomNavigationBarItem(
activeIcon: new SizedBox(height: 30,child: Image.asset('assets/icons/quran.png',color:Theme.of(context).accentColor,),),
icon: new SizedBox(height: 20,child: Image.asset('assets/icons/quran.png',),),
label: AppLocalizations.of(context)!.quran,
),
],
fixedColor: Colors.black,
currentIndex: selected,
showUnselectedLabels: false,
onTap: IconTap,
),
);
}
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/singleNavbarPages/Sebha.dart | import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:quran/tools/appconfig.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class Sebha extends StatefulWidget {
static const routeName = 'Sebha';
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<Sebha> with TickerProviderStateMixin {
late AnimationController _controller;
late appConfig provider;
int add = 0;
int swap = 0;
String value = 'Start';
void adder() {
setState(() {
_controller.forward();
if (add == 0 && swap == 0) {
add = 0;
swap = 1;
}
if (add < 33&& swap == 1) {
value = 'سبحان الله';
add++;
} else if (add == 33 && swap == 1) {
add = 0;
swap = 2;
value = 'الحمدلله';
} else if (add < 33 && swap == 2) {
value = 'الحمدلله';
add++;
} else if (add == 33 && swap == 2) {
add = 0;
swap = 3;
value = 'الله اكبر';
} else if (add < 33 && swap == 3) {
value = 'الله اكبر';
add++;
}
else if (add == 33 && swap == 3) {
add = 0;
swap =4;
value = 'استغفر الله العظيم';
} else if (add < 33 && swap == 4) {
value = 'استغفر الله العظيم';
add++;
}
else {
print(add);
value = 'Start';
add = 0;
swap = 0;
}
});
}
@override
void initState()
{
_controller =AnimationController(
duration: Duration(milliseconds: 100),
vsync: this,
);
super.initState();
}
@override
void dispose()
{
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
provider=Provider.of<appConfig>(context);
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'
),
fit: BoxFit.fill,
),
),
child: Padding(
padding: const EdgeInsets.only(top: 35.0),
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(AppLocalizations.of(context)!.islami,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 27,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri'))),
Container(
margin: EdgeInsets.only(top:30),
//alignment: Alignment.topRight,
child: Image(
height: 80, width: 80,
image:AssetImage('assets/icons/head of seb7a.png'))),
Container(
// margin: EdgeInsets.only(bottom:100),
// alignment: Alignment.topCenter,
child: RotationTransition(
turns: Tween(begin: 0.0,end:1.0).animate(_controller)
..addStatusListener((status) {
if(status==AnimationStatus.completed)
{
_controller.reverse();
}
}),
child: Image(
image: AssetImage('assets/icons/body of seb7a.png'),
width: 135,
height: 135,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(child: Text(AppLocalizations.of(context)!.tasbeehCount,style:
TextStyle(fontSize: 30,color: Theme.of(context).primaryColor, fontFamily: 'ElMessiri'),)
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: new BorderRadius.circular(10.0),
color:Theme.of(context).bottomAppBarColor,
),
width: 50,
height: 50,
child: Text(
add.toString(),style: TextStyle(fontSize: 30,color: Theme.of(context).primaryColor, fontFamily: 'ElMessiri'),
)
),
),
Padding(
padding: EdgeInsets.all(8),
child: ElevatedButton(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(value ,style: TextStyle(fontSize: 20,color: Theme.of(context).accentColor,fontFamily: 'ElMessiri'),),
),
onPressed: adder,
style: ElevatedButton.styleFrom(
primary:Theme.of(context).bottomAppBarColor,
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(20.0),
),
),
),
)
],
),
),
);
}
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Surah/surahContent.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:provider/provider.dart';
import 'package:quran/Surah/ListOfSurahNames.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'dart:async';
import 'package:quran/singleNavbarPages/navbar.dart';
import '../tools/appconfig.dart';
class surahContent extends StatefulWidget {
String surahName = "surah name";
late int surahNumber;
static const routeName = 'surahContent';
surahContent({this.surahName = 'surah name', this.surahNumber = 1}) : super();
@override
_surahContentState createState() => _surahContentState();
}
class _surahContentState extends State<surahContent> {
late Future _future;
String _data = '';
int ayahNumber = 1;
int surahLength = 0;
late List<String> surahReadedContet = [];
late List<String> finalSurahContent = [];
// This function is triggered when the user presses the icon button -temporarily-
Future<void> _loadData(int surahNumber) async {
final _loadedData = await rootBundle
.loadString('assets/ayat/' + surahNumber.toString() + '.txt');
_data = _loadedData;
surahReadedContet = _data.split('\n');
}
//this function adds the numbering to the surah
void _writeSurahInProperForm() async {
await _loadData(widget.surahNumber);
for (int i = 0; i < surahReadedContet.length; i++) {
finalSurahContent
.add(surahReadedContet[i] + '[' + ayahNumber.toString() + ']');
ayahNumber++;
}
ayahNumber = 1;
setState(() {
surahLength = finalSurahContent.length;
});
}
late appConfig provider;
@override
void initState() {
// TODO: implement initState
super.initState();
_writeSurahInProperForm();
}
@override
Widget build(BuildContext context) {
provider=Provider.of<appConfig>(context);
return Scaffold(
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(top: 25.0, bottom: 50.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(right: 5.0),
child: IconButton(
icon: Icon(
Icons.arrow_back_sharp,
color:Theme.of(context).accentColor,
size: 35.0,
),
onPressed: () {
Navigator.pop(context);
},
),
),
),
Container(
padding: EdgeInsets.only(left: 90.0, right: 135.0),
child: Text(
AppLocalizations.of(context)!.islami,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 27,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri'
),
),
),
],
),
SizedBox(
height: 25.0,
),
Container(
padding: EdgeInsets.only(top: 24.0, right: 18.0, left: 18.0),
width: MediaQuery.of(context).size.width * .80,
height: MediaQuery.of(context).size.height * .78,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Align(
alignment: Alignment.topCenter,
child: Text(
AppLocalizations.of(context)!.surah +' ' + widget.surahName ,
style: TextStyle(
color: Theme.of(context).accentColor,
fontWeight: FontWeight.w900,
fontSize: 22.0,
fontFamily: 'ElMessiri'
),
),
),
Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(
CupertinoIcons.arrowtriangle_right_circle_fill,
size: 27.0,
color:Theme.of(context).accentColor,
),
onPressed: () {
},
),
),
],
),
Divider(
indent: 18.0,
endIndent: 18.0,
thickness: 1.0,
color: Theme.of(context).accentColor,
),
Expanded(
child: Container(
child: surahLength ==0 ?Center(
child: CircularProgressIndicator(),
):ListView.builder(
shrinkWrap: true,
itemCount: finalSurahContent.length,
itemBuilder: (context, index) {
return
Text(finalSurahContent[index], style: TextStyle(color: Theme.of(context).accentColor, fontFamily: 'ElMessiri'),
textAlign: TextAlign.end,);
},
),
),
),
],
),
decoration: BoxDecoration(
color: provider.isDarkMode()? Theme.of(context).bottomAppBarColor : Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20)),
),
),
],
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill,
),
),
),
),
);
}
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Surah/ListOfSurahNames.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:quran/tools/appconfig.dart';
import 'package:quran/Surah/surahContent.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter/services.dart' show rootBundle;
class ListOfSurahNames extends StatefulWidget {
static const routeName = 'SurahNames';
@override
_ListOfSurahNamesState createState() => _ListOfSurahNamesState();
}
class _ListOfSurahNamesState extends State<ListOfSurahNames> {
late List<String> names = [
'الفاتحة',
'البقرة',
'آل عمران',
'النساء',
'المائدة',
'الانعام',
'الاعراف',
'الانفال',
'التوبة',
'يونس',
'هود',
'يوسف',
'الرعد',
'ابراهيم',
'الحجر',
'النحل',
'الاسراء',
'الكهف',
'مريم',
'طه',
'الأنبياء',
'الحج',
'المؤمنون',
'النور',
];
late List<String> AyatNumbers = [
'7',
'286',
'200',
'176',
'120',
'165',
'206',
'75',
'129',
'109',
'123',
'111',
'43',
'52',
'99',
'128',
'111',
'110',
'98',
'135',
'112',
'78',
'118',
'64',
'77',
'227',
'93',
'88',
'69',
'60',
'34',
'30',
'73',
'54',
'45',
'83',
'182',
'88',
'75',
'85',
'54',
'53',
'89',
'59',
'37',
'35',
'38',
'29',
'18',
'45',
'60',
'49',
'62',
'55',
'78',
'96',
'29',
'22',
'24',
'13',
'14',
'11',
'11',
'18',
'12',
'12',
'30',
'52',
'52',
'44',
'28',
'28',
'20',
'56',
'40',
'31',
'50',
'40',
'46',
'42',
'29',
'19',
'36',
'25',
'22',
'17',
'19',
'26',
'30',
'20',
'15',
'21',
'11',
'8',
'5',
'19',
'5',
'8',
'8',
'11',
'11',
'8',
'3',
'9',
'5',
'4',
'6',
'3',
'6',
'3',
'5',
'4',
'5',
'6'
];
late appConfig provider;
@override
Widget build(BuildContext context) {
provider = Provider.of<appConfig>(context);
return Container(
//constraints: BoxConstraints.expand(),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill)),
child: Padding(
padding: const EdgeInsets.only(top: 35.0),
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(AppLocalizations.of(context)!.islami,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 27,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri'))),
Center(
child: Image(
image: AssetImage('assets/icons/Screenshot.png'),
alignment: Alignment.center,
width: 135,
height: 135,
)),
Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide( color: provider.isDarkMode()? Colors.yellow: Colors.brown,),
bottom: BorderSide( color: provider.isDarkMode()? Colors.yellow: Colors.brown,),
)
//Border.all(color: Theme.of(context).accentColor),
),
child: Row(
children: [
Expanded(
child: Container(
padding: const EdgeInsets.all(5.0),
alignment: AlignmentDirectional.centerStart,
child: Center(
child: Text(AppLocalizations.of(context)!.verses,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 15,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri')),
),
),
),
Expanded(
child: Container(
padding: const EdgeInsets.all(5.0),
alignment: AlignmentDirectional.centerStart,
child: Center(
child: Text(AppLocalizations.of(context)!.surahName,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 15,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri')),
),
),
),
],
),
),
Expanded(
child: Container(
alignment: AlignmentDirectional.centerEnd,
child: ListView.builder(
padding: const EdgeInsets.all(8),
itemCount: names.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
child: Container(
padding: const EdgeInsets.all(4.0),
alignment: AlignmentDirectional.bottomEnd,
child: Row(
children: [
Expanded(
child: Center(
child: Text(
AyatNumbers[index],
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 15,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri'),
),
)),
Expanded(
child: Container(
decoration: provider.isEnglish()? (BoxDecoration(
border: Border(
left: BorderSide( color: provider.isDarkMode()? Colors.yellow: Colors.brown),
)
)): (BoxDecoration(
border: Border(
right: BorderSide( color: provider.isDarkMode()? Colors.yellow: Colors.brown),
)
)),
child: Center(
child: Text(names[index],
style: TextStyle(
color:
Theme.of(context).primaryColor,
fontSize: 18,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri')),
),
)),
],
),
),
onTap: () {
var route = new MaterialPageRoute(
builder: (BuildContext context) => surahContent(
surahName: names[index],
surahNumber: (index + 1),
),
);
Navigator.of(context).push(route);
});
}),
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/model/Radios.dart | class Radios {
String ?name = '';
String ?radioUrl = '';
Radios(
this.name,
this.radioUrl);
Radios.fromJson(dynamic json) {
name = json['name'];
radioUrl = json['radio_url'];
}
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/model/RadioResponse.dart | import 'Radios.dart';
class RadioResponse {
List<Radios> radios = [];
RadioResponse({required List<Radios> radios}){
radios = radios;
}
RadioResponse.fromJson(dynamic json) {
if (json['radios'] != null) {
radios = [];
json['radios'].forEach((v) {
radios.add(Radios.fromJson(v));
});
}
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/tools/myThemeData.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class MythemeData{
static final lightTheme=ThemeData(
primaryColor: Colors.black,
bottomAppBarColor: Colors.brown,
accentColor: Colors.black,
secondaryHeaderColor:Colors.white,
);
static final darkTheme=ThemeData(
primaryColor: Colors.white,
bottomAppBarColor: Color(0xFF141A2E),
accentColor: Color(0xFFFBC927),
secondaryHeaderColor:Color(0xFF141A2E),
);
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/tools/appconfig.dart | import 'package:flutter/material.dart';
class appConfig extends ChangeNotifier {
appConfig(){}
ThemeMode themeMode = ThemeMode.dark;
String currentLanguage = 'en';
void toggleTheme() {
if (themeMode == ThemeMode.light)
themeMode = ThemeMode.dark;
else
themeMode = ThemeMode.light;
notifyListeners();
}
bool isDarkMode() {
return themeMode == ThemeMode.dark;
}
bool isEnglish() => currentLanguage == 'en';
void changeLanguage(String language) {
if (currentLanguage == language) return;
currentLanguage = language;
notifyListeners();
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/APIs/APImanager.dart | import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:quran/model/RadioResponse.dart';
Future<RadioResponse> getRadios(String language) async {
language = language=='en'?'english':'arabic';
final uri = Uri.https("api.mp3quran.net", "/radios/radio_" + language + ".json");
final response = await http.get(uri);
print(response.body);
if (response.statusCode == 200) {
return RadioResponse.fromJson(jsonDecode(response.body));
} else {
throw Exception(response.body);
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Radio/AudioMethods.dart | import 'package:just_audio/just_audio.dart';
class AudioMethods{
late final AudioPlayer radioPlayer = AudioPlayer();
} | 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Radio/listeningIcons.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:quran/singleNavbarPages/navbar.dart';
import 'package:quran/tools/appconfig.dart';
class listeningIcons extends StatefulWidget {
late IconData icon;
late appConfig provider;
late Function buttonAction;
listeningIcons(this.icon, this.buttonAction);
@override
_listeningIconsState createState() => _listeningIconsState();
}
class _listeningIconsState extends State<listeningIcons> {
@override
Widget build(BuildContext context) {
widget.provider = Provider.of<appConfig>(context);
return Expanded(
child: IconButton(
icon: Icon(widget.icon,
color: widget.provider.isDarkMode()? Colors.yellow: Theme.of(context).bottomAppBarColor,
size: 25,),
onPressed:()
{
widget.buttonAction();
}
),
);
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Radio/RadioPage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:quran/APIs/APImanager.dart';
import 'package:quran/Radio/listeningIcons.dart';
import 'package:quran/model/RadioResponse.dart';
import 'package:quran/model/Radios.dart';
import 'package:quran/tools/appconfig.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:just_audio/just_audio.dart';
import 'dart:convert';
class RadioPage extends StatefulWidget {
static const routeName = 'RadioPage';
@override
_RadioPageState createState() => _RadioPageState();
}
class _RadioPageState extends State<RadioPage> {
final AudioPlayer radioPlayer = AudioPlayer();
late Future<RadioResponse> RadioFuture;
late appConfig provider;
late List<Radios> radios = [];
late String channelName = 'Channel Name';
late String RadioUrl = 'url';
int index = 0;
@override
Widget build(BuildContext context) {
provider = Provider.of<appConfig>(context);
RadioFuture = getRadios(provider.currentLanguage);
return Container(
//constraints: BoxConstraints.expand(),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill)),
child: Padding(
padding: const EdgeInsets.only(top: 35.0),
child: Column(
children: [
Center(
child: Text(AppLocalizations.of(context)!.islami,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 27,
fontWeight: FontWeight.bold,
fontFamily: 'ElMessiri'))),
Padding(
padding: const EdgeInsets.only(top: 50),
child: Center(
child: Image(
image: AssetImage('assets/icons/radio.png'),
alignment: Alignment.center,
width: 350,
height: 260,
)),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: FutureBuilder<RadioResponse>
(
future: RadioFuture,
builder: (BuildContext, snapshot) {
if (snapshot.hasData) {
radios = snapshot.data!.radios;
String utf8convert(String text) {
List<int> bytes = text.toString().codeUnits;
return utf8.decode(bytes);
}
print('from remote:' + snapshot.data!.radios.length.toString() + '\nfrom class: ' + radios.length.toString());
channelName = (radios!= null)?radios[index].name??' ':'Radio';
channelName=utf8convert(channelName);
return Center(
child: Text(channelName,
style: TextStyle(color: provider.isDarkMode()
? Colors.white
: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 14,
fontFamily: 'ElMessiri'))
);
}
else if (snapshot.hasError) {
return Text('Error');
}
else {
return Center(
child: CircularProgressIndicator(
color: Theme.of(context).bottomAppBarColor));
}
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
listeningIcons(CupertinoIcons.backward_end_fill, previous_channel),
listeningIcons(radioPlayer.playing?CupertinoIcons.pause_fill:CupertinoIcons.arrowtriangle_right_fill,radioPlayer.playing?pause: play),
listeningIcons(CupertinoIcons.forward_end_fill,next_channel),
],
),
),
],
),
),
);
}
next_channel()
{
setState(() {
if(index<(radios.length-1))
index+=1;
channelName = (radios != [])?radios[index].name??' ': channelName;
if(radioPlayer.playing)
play();
});
}
previous_channel()
{
setState(() {
if(index>0)
index-=1;
channelName = (radios != [])?radios[index].name??' ': channelName;
if(radioPlayer.playing)
play();
});
}
play()
{
RadioUrl = (radios != [])?radios[index].radioUrl??' ': RadioUrl;
setState(() {
radioPlayer.setUrl(RadioUrl);
radioPlayer.play();
});
}
pause()
{
setState(() {
radioPlayer.pause();
});
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Ahadeeth/AhadeethContent.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'dart:async';
import 'package:quran/singleNavbarPages/navbar.dart';
import '../tools/appconfig.dart';
class AhadeethContent extends StatefulWidget {
late int hadeethNumber;
late appConfig provider;
static const routeName = 'AhadeethContent';
AhadeethContent({this.hadeethNumber = 1}) : super();
@override
_AhadeethContentState createState() => _AhadeethContentState();
}
class _AhadeethContentState extends State<AhadeethContent> {
late Future _future;
late String finalAhadeethContent = '';
// This function is triggered when the user presses the icon button -temporarily-
Future<void> _loadData(int surahNumber) async {
final _loadedData = await rootBundle
.loadString('assets/ahadeeth/' + surahNumber.toString() + '.txt');
setState(() {
finalAhadeethContent = _loadedData;
});
//print(_data);
}
@override
void initState() {
// TODO: implement initState
super.initState();
_loadData(widget.hadeethNumber);
}
late appConfig provider;
@override
Widget build(BuildContext context) {
provider=Provider.of<appConfig>(context);
return Scaffold(
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(top: 25.0, bottom: 50.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(right: 5.0),
child: IconButton(
icon: Icon(
Icons.arrow_back_sharp,
color:Theme.of(context).primaryColor,
size: 35.0,
),
onPressed: () {
Navigator.pop(context);
},
),
),
),
Container(
padding: EdgeInsets.only(left: 90.0, right: 135.0),
child: Text(
AppLocalizations.of(context)!.islami,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 27,
fontWeight: FontWeight.bold,
fontFamily: 'ReemKufi'
),
),
),
],
),
SizedBox(
height: 25.0,
),
Container(
padding: EdgeInsets.only(top: 24.0, right: 18.0, left: 18.0),
width: MediaQuery.of(context).size.width /1.3,
height: MediaQuery.of(context).size.height /1.3,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Align(
alignment: Alignment.topCenter,
child: Text(
provider.isEnglish()? 'Hadeeth No.${widget.hadeethNumber}' : ' حديث رقم ${widget.hadeethNumber} ',
style: TextStyle(
color: Theme.of(context).accentColor,
fontWeight: FontWeight.w900,
fontSize: 22.0,
fontFamily: 'ReemKufi'
),
),
),
Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(
CupertinoIcons.arrowtriangle_right_circle_fill,
size: 27.0,
color:Theme.of(context).accentColor,
),
onPressed: () {
},
),
),
],
),
Divider(
indent: 13.0,
endIndent: 13.0,
thickness: 1.0,
color: Colors.brown,
),
Expanded(
child: Container(
child: finalAhadeethContent =='' ?Center(
child: CircularProgressIndicator(),
):ListView.builder(
shrinkWrap: true,
itemCount: 1,
itemBuilder: (context, index) {
return
Text(finalAhadeethContent, style: TextStyle(color:Theme.of(context).accentColor,
fontFamily: 'islami'), textAlign: TextAlign.end,);
},
),
),
),
],
),
decoration: BoxDecoration(
color: provider.isDarkMode()? Theme.of(context).bottomAppBarColor : Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20)),
),
),
],
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill,
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/quran/lib | mirrored_repositories/quran/lib/Ahadeeth/AhadeethMenu.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:quran/Ahadeeth/AhadeethContent.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quran/tools/appconfig.dart';
class AhadeethMenu extends StatefulWidget {
static const routeName = 'SurahNames';
@override
_AhadeethMenuState createState() => _AhadeethMenuState();
}
class _AhadeethMenuState extends State<AhadeethMenu> {
@override
late appConfig provider;
Widget build(BuildContext context) {
provider=Provider.of<appConfig>(context);
return Container(
//constraints: BoxConstraints.expand(),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
provider.isDarkMode()
? 'assets/images/bg.png'
: 'assets/images/bg3.png'),
fit: BoxFit.fill)),
child: Padding(
padding: const EdgeInsets.only(top: 35.0),
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(AppLocalizations.of(context)!.islami,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 27,
fontWeight: FontWeight.bold,
fontFamily: 'ReemKufi'))),
Center(child:
Image(image: AssetImage('assets/icons/ahadeethPage.png'),alignment: Alignment.center, width: 150, height: 150,)
),
Container(
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
border: Border(
top: BorderSide( color: provider.isDarkMode()? Colors.yellow: Colors.brown),
bottom: BorderSide( color: provider.isDarkMode()? Colors.yellow: Colors.brown),
)
//Border.all(color: Theme.of(context).accentColor),
),
child: Center(
child: Text(AppLocalizations.of(context)!.hadeeth,
style: TextStyle(color: Theme.of(context).primaryColor, fontSize: 17, fontWeight: FontWeight.bold, fontFamily: 'ReemKufi'))),
),
Expanded(
child: Container(
alignment: AlignmentDirectional.centerEnd,
child: ListView.builder(
padding: const EdgeInsets.all(10),
itemCount: 10,
itemBuilder: (BuildContext context, int index){
return GestureDetector(
child:
Container(
padding: const EdgeInsets.all(8.0),
child: Center(child:
Text( provider.isEnglish()? 'Hadeeth No.${index+1}' : ' حديث رقم ${index+1} ',
style: TextStyle(color: Theme.of(context).primaryColor,
fontSize: 18, fontWeight: FontWeight.bold,fontFamily: 'ReemKufi'),)
),
),
onTap: () {
var route = new MaterialPageRoute(
builder: (BuildContext context) => AhadeethContent( hadeethNumber: (index+1)),
);
Navigator.of(context).push(route);
});
}
),
),
)
],
),
),
);
}
} | 0 |
mirrored_repositories/quran | mirrored_repositories/quran/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 that Flutter provides. 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:quran/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/signin-and-signup-UI-in-flutter | mirrored_repositories/signin-and-signup-UI-in-flutter/lib/main.dart | import 'package:flutter/material.dart';
import 'package:login_logout_screen/view/signin/signin.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Login / Logout',
theme: ThemeData(
primarySwatch: Colors.blue,
appBarTheme:
AppBarTheme(backgroundColor: Color(0xfffafbfb), elevation: 0),
),
home: Signin(),
);
}
}
| 0 |
mirrored_repositories/signin-and-signup-UI-in-flutter/lib/view | mirrored_repositories/signin-and-signup-UI-in-flutter/lib/view/signup/signup.dart | import 'package:flutter/material.dart';
import 'package:login_logout_screen/view/signin/signin.dart';
import 'package:login_logout_screen/widgets/build_text.dart';
class Signup extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
iconTheme: IconThemeData(color: Color(0xff003CC0)),
),
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(top: 5, left: 30, right: 30, bottom: 30),
child: Column(
children: [
BuildText(
text: 'Create Account',
fontSize: 30,
fontWeight: FontWeight.bold,
color: Color(0xff003CC0),
),
BuildText(
text: 'Create a new account',
fontSize: 18,
fontWeight: FontWeight.w300,
color: Color(0xff003CC0),
),
SizedBox(height: 40),
Form(
child: Column(
children: [
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.person_outline,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '[email protected]',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'NAME'),
),
SizedBox(height: 20),
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '[email protected]',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'EMAIL'),
),
SizedBox(height: 20),
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.phone_iphone,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '+91 9876543210',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'PHONE'),
),
SizedBox(height: 20),
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.lock,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '**********',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'PASSWORD'),
),
SizedBox(height: 20),
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.lock,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '**********',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'CONFIRM PASSWORD'),
),
],
),
),
SizedBox(height: 20),
MaterialButton(
height: 50,
minWidth: 300,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
color: Color(0xff003CC0),
onPressed: () {},
child: BuildText(
text: 'CREATE ACCOUNT',
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
BuildText(
text: "Already have a account?",
),
SizedBox(width: 5),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Signin()));
},
child: BuildText(
text: 'Login',
color: Color(0xff003CC0),
),
)
],
)
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/signin-and-signup-UI-in-flutter/lib/view | mirrored_repositories/signin-and-signup-UI-in-flutter/lib/view/signin/signin.dart | import 'package:flutter/material.dart';
import 'package:login_logout_screen/view/signup/signup.dart';
import 'package:login_logout_screen/widgets/build_text.dart';
class Signin extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(30),
child: Column(
children: [
Image.asset(
'img/ice-cream.png',
height: 100,
width: 100,
),
BuildText(
text: 'Welcome Back',
fontSize: 30,
fontWeight: FontWeight.bold,
color: Color(0xff003CC0),
),
BuildText(
text: 'Sign to continue',
fontSize: 20,
fontWeight: FontWeight.w300,
color: Color(0xff003CC0),
),
SizedBox(height: 50),
Form(
child: Column(
children: [
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '[email protected]',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'Email'),
),
SizedBox(height: 30),
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.blue[300],
),
border: OutlineInputBorder(),
hintText: '********',
hintStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold),
labelText: 'Password'),
),
],
),
),
Align(
alignment: Alignment.centerRight,
child: TextButton(
onPressed: () {},
child: BuildText(
text: 'Forgot Password?',
fontWeight: FontWeight.bold,
),
),
),
SizedBox(height: 20),
MaterialButton(
height: 50,
minWidth: 300,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
color: Color(0xff003CC0),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Signup()));
},
child: BuildText(
text: 'LOGIN',
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
BuildText(
text: "Don't have account?",
),
SizedBox(width: 5),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Signup()));
},
child: BuildText(
text: 'create a new account',
color: Color(0xff003CC0),
),
)
],
)
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/signin-and-signup-UI-in-flutter/lib | mirrored_repositories/signin-and-signup-UI-in-flutter/lib/widgets/build_text.dart | import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class BuildText extends StatelessWidget {
final String text;
final int maxLines;
final TextOverflow textOverflow;
final TextAlign textAlign;
final Color color;
final double fontSize;
final FontWeight fontWeight;
const BuildText({
Key key,
this.text,
this.maxLines,
this.textOverflow,
this.color,
this.fontSize,
this.fontWeight,
this.textAlign,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Text(
text,
maxLines: maxLines,
overflow: textOverflow,
textAlign: textAlign,
style: GoogleFonts.roboto(
color: color, fontSize: fontSize, fontWeight: fontWeight),
);
}
}
| 0 |
mirrored_repositories/signin-and-signup-UI-in-flutter | mirrored_repositories/signin-and-signup-UI-in-flutter/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 that Flutter provides. 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:login_logout_screen/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/WeatherAppFlutter | mirrored_repositories/WeatherAppFlutter/lib/httppage.dart | import 'dart:convert';
// import 'package:dioapi/Content/Constants.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'Content/Constants.dart';
class HttpPage extends StatefulWidget {
@override
_HttpPageState createState() => _HttpPageState();
}
class _HttpPageState extends State<HttpPage> {
// create a future
Future getResponse() async {
// method must be async for future content
// we have to pass a link in string format
http.Response response = await http.get(
'https://api.weatherapi.com/v1/current.json?key=68ea3b75c9c2462787e52106211203&q=$location&aqi=yes');
// convert json data to
//convert data must be stored in a Map formate
Map<String, dynamic> result = jsonDecode(response.body.toString());
setState(() {
//temp_c return double type value and we are using round method to remove decimal value
temp = result['current']['temp_c'].round();
location = result['location']['name'];
country = result['location']['country'];
});
print(result.toString().toUpperCase());
}
@override
void initState() {
this.getResponse();
super.initState();
}
// as we have seen in our ui from last video we can set data Accordingly
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(),
body: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
location + ', ' + country,
style: TextStyle(color: Colors.white),
),
Text(
temp.toString(),
style: customGrey,
),
// like this you can get all the data that you needs
],
),
),
),
),
);
}
}
// thats it for today
// thank you
| 0 |
mirrored_repositories/WeatherAppFlutter | mirrored_repositories/WeatherAppFlutter/lib/HomePage.dart | import 'package:flutter/material.dart';
import 'Content/Appbar.dart';
import 'Content/Body.dart';
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Colors.black,
appBar: appBar,
body: BodyWidget(),
),
);
}
}
| 0 |
mirrored_repositories/WeatherAppFlutter | mirrored_repositories/WeatherAppFlutter/lib/DioPackage.dart | import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
import 'Content/Constants.dart';
import 'package:geolocator/geolocator.dart';
// hey guys today we are learing that how to get your current location weather using geolocation publication
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
// create a async method to get data from API
Future getWeather() async {
// use try catch block for any exception
try {
// response store data in json format
// dio use get property to fetch data it should take some time so make it with await
// we are weatherapi's API it free you can use what ever you want
// currently we are doing that to fetch user current location and share data according
// we are using some demo text that start our api data
var response = await Dio().get(
'https://api.weatherapi.com/v1/current.json?key=68ea3b75c9c2462787e52106211203&q=$location&aqi=yes');
Map<String, dynamic> data = jsonDecode(response.toString());
// jsonDecode convert data into string for further use by using MAP property
setState(() {
// country and city name that print in App Bar
country = data['location']['country'].toString();
location = data['location']['name'].toString();
// to be so sure it should be as string type
temp = data['current']['temp_c'].round();
// round method convert double value into integer
// local time according to location that searched
time = data['location']['localtime'].toString();
// temperature in far
tempf = data['current']['temp_f'].round();
humidity = data['current']['humidity'].round();
wind = data['current']['wind_kph'].round();
// we are using two property to get icon according to weather codition
// API return unfinished link of icon that why we are using
cacheIcon = data['current']['condition']['icon'].toString();
src = 'https:' + cacheIcon; // this to combine and get propper icon
loading = true;
// print data into consol
});
} on Exception catch (e) {
print(e.toString().toUpperCase());
}
}
// methd to get weather detail using location
Future getWeatherByLocation(latitude, longitude) async {
//http://api.openweathermap.org/data/2.5/weather?lat=28.67&lon=77.22&appid=0fe03700518423ac4a10d937dd52aba5
String url =
'http://api.openweathermap.org/data/2.5/weather?lat=$latitude&lon=$longitude&appid=0fe03700518423ac4a10d937dd52aba5&units=metric';
var response = await Dio().get(url);
var convert =
jsonDecode(response.toString()); // using dio you need only response
setState(() {
loading = true;
location = convert['name'];
temp = convert['main']['temp'].round();
humidity = convert['main']['humidity'];
country = convert['sys']['country'];
});
}
TextEditingController controller = TextEditingController();
//http://api.openweathermap.org/data/2.5/weather?lat=28.67&lon=77.22&appid=0fe03700518423ac4a10d937dd52aba5
// using init method to initialize our typed location to run at starting time of app
// lets create a method to find current location
Future getLocation() async {
Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
if (position != null) {
getWeatherByLocation(position.latitude, position.longitude);
}
}
bool loading = false;
@override
void initState() {
super.initState();
this.getWeather();
this.getLocation();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
double height = size.height.toDouble();
return Container(
decoration: BoxDecoration(
// background color
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff0e1e29),
Color(0xff5292a4),
],
),
),
child: loading
? Scaffold(
backgroundColor: Colors.transparent,
appBar: buildAppBar(),
body: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
child: buildTextField(),
width: size.width / 1.6,
),
IconButton(
icon: Icon(
Icons.search,
size: 20,
color: Colors.white,
),
onPressed: () {
setState(() {
location = controller.text;
loading = false;
});
getWeather();
},
)
],
),
),
// buildWeatherIcon(),
buildTempField(height),
// buildRowData(
// data: tempf.toString() + ' f',
// text: 'Temp in F',
// ),
SizedBox(height: 10),
buildRowData(
data: humidity.toString() + ' %',
text: 'Humidity',
),
SizedBox(height: 10),
// buildRowData(
// data: wind.toString() + ' Kph',
// text: 'Wind',
// ),
SizedBox(height: 10),
Divider(thickness: 2),
SizedBox(height: 10),
],
),
),
)
: Scaffold(
body: Container(
child: Center(
child: CircularProgressIndicator(),
)),
),
);
}
// Icon represent according to Climate
Image buildWeatherIcon() {
return Image.network(
src,
height: 70,
width: 70,
fit: BoxFit.cover,
);
}
// Data Like Temp in farenheit, wind speed
Row buildRowData({
String text,
String data,
}) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
text,
style: customGrey,
),
Text(
data,
style: customGrey,
),
],
);
}
// Temperature Display
FittedBox buildTempField(double height) {
return FittedBox(
fit: BoxFit.fill,
child: Row(
children: [
Text(
temp.toString(),
style: TextStyle(fontSize: height / 8, color: Colors.white),
),
SizedBox(width: 5),
Text(
'°C',
style: TextStyle(
fontSize: height / 8.5,
color: Colors.white,
),
),
],
),
);
}
// Search Bar
TextField buildTextField() {
return TextField(
controller: controller,
decoration: InputDecoration(
hintText: 'Search City',
hintStyle: TextStyle(
color: Colors.grey,
),
),
style: TextStyle(
color: Colors.white,
),
);
}
// App Bar
AppBar buildAppBar() {
return AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
IconButton(
icon: Icon(
Icons.refresh,
color: Colors.grey,
),
onPressed: () {
setState(() {
getWeather();
// on referesh weather get updated
});
},
),
],
title: appData(),
);
}
// Text Fields of App Bar
Column appData() {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
time.toString(),
// time
style: smallText,
),
SizedBox(height: 7),
FittedBox(
fit: BoxFit.fitWidth,
child: Row(
children: [
Icon(
Icons.room,
color: Colors.red,
size: 20,
),
SizedBox(width: 5),
// location
Text(
location.toString() + " ," + country.toString().toUpperCase(),
style: smallText.copyWith(
color: Colors.white54,
),
),
],
),
),
],
);
}
}
| 0 |
mirrored_repositories/WeatherAppFlutter | mirrored_repositories/WeatherAppFlutter/lib/main.dart | import 'package:flutter/material.dart';
import 'DioPackage.dart';
import 'HomePage.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: ' Weather App',
debugShowCheckedModeBanner: false,
home: Home(),
);
}
}
| 0 |
mirrored_repositories/WeatherAppFlutter/lib | mirrored_repositories/WeatherAppFlutter/lib/Content/Body.dart | import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_fonts/google_fonts.dart';
import 'Constants.dart';
import 'package:http/http.dart ' as http;
import 'dart:convert';
class BodyWidget extends StatefulWidget {
// create object of class to import its property
@override
_BodyWidgetState createState() => _BodyWidgetState();
}
class _BodyWidgetState extends State<BodyWidget> {
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
double height = size.height.toDouble();
double width = size.width.toDouble();
return Container(
width: double.infinity,
child: Stack(
children: [
Positioned(
top: 50,
child: Image.network(
background,
height: height / 3,
width: width,
filterQuality: FilterQuality.high,
fit: BoxFit.cover,
),
),
Positioned(
top: height / 7,
left: width / 3.5,
child: Container(
child: Stack(
children: [
Positioned(
top: -20,
child: Image.asset(
fog,
height: 150,
width: 150,
),
),
Row(
children: [
Text(
'6',
style: GoogleFonts.stylish(
fontSize: height / 5,
color: Colors.white,
),
),
SizedBox(width: 5),
Text(
'C',
style: GoogleFonts.stylish(
fontSize: height / 5,
color: Colors.white,
),
),
],
),
],
),
),
),
Positioned(
top: height / 1.8,
left: 50,
child: Text(
'Weather Forcast',
style: smallText.copyWith(
fontSize: 24,
color: Colors.grey,
),
),
),
Positioned(
top: height / 1.6,
left: 20,
child: Container(
child: Row(
children: [
CustomCard(
temp: '17',
image: rainy,
mode: 'Rainy',
),
SizedBox(width: 10),
CustomCard(
temp: '34',
image: sun,
mode: 'Sunny',
),
SizedBox(width: 10),
CustomCard(
temp: '12',
image: cloudy,
mode: 'Rainy',
),
SizedBox(width: 10),
],
),
),
)
],
),
);
}
}
class CustomCard extends StatelessWidget {
const CustomCard({
Key key,
this.image,
this.temp,
this.mode,
}) : super(key: key);
final String image;
final String temp;
final String mode;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.blueGrey[800],
borderRadius: BorderRadius.circular(17),
),
height: 150,
width: 150,
child: Column(
children: [
Image.asset(
image,
height: 70,
width: 100,
fit: BoxFit.cover,
),
Text(
mode,
style: smallText,
),
Text(
temp,
style: smallText,
),
],
),
);
}
}
| 0 |
mirrored_repositories/WeatherAppFlutter/lib | mirrored_repositories/WeatherAppFlutter/lib/Content/Appbar.dart | import 'package:flutter/material.dart';
import 'Constants.dart';
import 'package:google_fonts/google_fonts.dart';
bool value = false;
void onChanged(bool value) {
value = !value;
}
AppBar appBar = AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
Switch(
value: value,
onChanged: onChanged,
inactiveTrackColor: Colors.yellow,
),
],
title: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'09/03/2021',
style: GoogleFonts.lato(
fontSize: 17,
color: Colors.white,
),
),
SizedBox(height: 7),
Row(
children: [
Icon(
Icons.room,
color: Colors.red,
size: 20,
),
SizedBox(width: 5),
Text(
'Delhi,',
style: smallText,
),
Text(
'India',
style: smallText.copyWith(color: Colors.grey),
),
],
),
],
),
);
| 0 |
mirrored_repositories/WeatherAppFlutter/lib | mirrored_repositories/WeatherAppFlutter/lib/Content/Constants.dart | import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
TextStyle smallText = GoogleFonts.lato(
fontSize: 18,
color: Colors.white,
);
// image class to store details of all images i am gona use it in my projects.
String sun = 'assets/sun.png';
String fog = 'assets/fog.png';
String rainy = 'assets/rainy.png';
String cloudy = 'assets/cloudy.png';
String background = 'https://pngimg.com/uploads/world_map/world_map_PNG28.png';
var location, country, temp, time, tempf, humidity, wind, cacheIcon, src;
TextStyle customGrey = TextStyle(
color:Colors.grey,
fontSize: 16,
);
| 0 |
mirrored_repositories/WeatherAppFlutter | mirrored_repositories/WeatherAppFlutter/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 that Flutter provides. 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:dioapi/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.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/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_17.dart | // Given a list of integers, write a Dart function named squareValues that uses the map() method to create a new list with each value squared. The function should take in the original list as a parameter and return the new list.
void main() {
List<int> originalList = [1, 2, 3, 4, 5];
List<int> squaredList = squareValues(originalList);
print("Original List: $originalList");
print("Squared List: $squaredList");
}
List<int> squareValues(List<int> originalList) {
List<int> squaredList =
originalList.map((number) => number * number).toList();
return squaredList;
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_15.dart | //Implement a Dart function named getPositiveNumbers that uses the where() method to filter out negative numbers from a list of integers. The function should take in the original list as a parameter and return a new list containing only the positive numbers.
void main() {
List<int> originalList = [-2, 5, -8, 1, 0, 3, -4];
List<int> positiveNumbersList = getPositiveNumbers(originalList);
print("Original List: $originalList");
print("Positive Numbers List: $positiveNumbersList");
}
List<int> getPositiveNumbers(List<int> originalList) {
List<int> positiveNumbers =
originalList.where((number) => number > 0).toList();
return positiveNumbers;
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_8.dart | // remove all false values from below list by using removeWhere or retainWhere property.
void main() {
List<Map<String, dynamic>> usersEligibility = [
{'name': 'John', 'eligible': true},
{'name': 'Alice', 'eligible': false},
{'name': 'Mike', 'eligible': true},
{'name': 'Sarah', 'eligible': true},
{'name': 'Tom', 'eligible': false},
];
usersEligibility.removeWhere((user) => user['eligible'] == false);
print(usersEligibility);
//now here we use retainWhere property.
usersEligibility.retainWhere((user) => user['eligible'] == true);
//same output
print(usersEligibility);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_3.dart | // Create a list of Days and remove one by one from the end of list
void main() {
List<String> daysOfWeek = [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'
];
print('Original List: $daysOfWeek');
daysOfWeek.remove("Monday");
print(daysOfWeek);
daysOfWeek.remove('Tuesday');
print(daysOfWeek);
daysOfWeek.remove('Wednesday');
print(daysOfWeek);
daysOfWeek.remove('Thursday');
print(daysOfWeek);
daysOfWeek.remove('Friday');
print(daysOfWeek);
daysOfWeek.remove('Saturday');
print(daysOfWeek);
daysOfWeek.remove('Sunday');
print(daysOfWeek);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_7.dart | /*Map<String, double> expenses = {
'sun': 3000.0,
'mon': 3000.0,
'tue': 3234.0,
};
Check if "fri" exist in expanses; if exist change it's value to 5000.0 otherwise
add 'fri' to expenses and set its value to 5000.0 then print expenses*/
void main() {
Map<String, double> expenses = {
'sun': 3000.0,
'mon': 3000.0,
'tue': 3234.0,
};
if (expenses.containsKey('fri')) {
expenses['fri'] = 5000.0;
} else {
expenses['fri'] = 5000.0;
}
print(expenses);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_16.dart | //Implement a Dart function named getEvenNumbers that uses the where() method to filter out odd numbers from a list of integers. The function should take in the original list as a parameter and return a new list containing only the even numbers.
void main() {
List<int> originalList = [1, 2, 3, 4, 5, 6, 7, 8, 9];
List<int> evenNumbersList = getEvenNumbers(originalList);
print("Original List: $originalList");
print("Even Numbers List: $evenNumbersList");
}
List<int> getEvenNumbers(List<int> originalList) {
List<int> evenNumbers =
originalList.where((number) => number % 2 == 0).toList();
return evenNumbers;
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_21.dart | //Given a map representing a user with keys "name", "isAdmin", and "isActive", write Dart code to check if the user is an active admin. If the user is both an admin and active, print "Active admin", otherwise print "Not an active admin"
void main() {
Map<String, dynamic> user = {
'name': 'John',
'isAdmin': true,
'isActive': true,
};
bool isActiveAdmin = user['isAdmin'] == true && user['isActive'] == true;
if (isActiveAdmin) {
print('Active admin');
} else {
print('Not an active admin');
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_1.dart | //Create a list of names and print all names using the List method.
void main() {
List<String> listNames = ["Aamir", "Zain", "Israr", "Naveed", "Farhan"];
print(listNames);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_18.dart | //Create a map named "person" with the following key-value pairs: "name" as "John", "age" as 25, "isStudent" as true. Write a Dart code to check if the person is both a student and over 18 years old. Print "Eligible" if both conditions are true, otherwise print "Not eligible"
void main() {
Map<String, dynamic> person = {
'name': 'Aamir',
'age': 21,
'isStudent': true,
};
bool isEligible = person['isStudent'] == true && person['age'] > 18;
if (isEligible) {
print('Eligible');
} else {
print('Not eligible');
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_2.dart | //Create an empty list of type string called days. Use the add method to add names of 7 days and print all days
void main() {
List<String> days = []; // creating an empty list of type string called days
days.add("Monday"); // adding names of 7 days using add() method
days.add("Tuesday");
days.add("Wednesday");
days.add("Thursday");
days.add("Friday");
days.add("Saturday");
days.add("Sunday");
print(days); //print command use to print list of days
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_20.dart | //Create a map named "car" with the following key-value pairs: "brand" as "Toyota", "color" as "Red", "isSedan" as true. Write Dart code to check if the car is a sedan and red in color. Print "Match" if both conditions are true, otherwise print "No match
void main() {
Map<String, dynamic> car = {
'brand': 'Toyota',
'color': 'Red',
'isSedan': true,
};
bool isMatch = car['isSedan'] == true && car['color'] == 'Red';
if (isMatch) {
print('Match');
} else {
print('No match');
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_13.dart | //Implement a code that takes in a list of integers and returns a new list containing only the unique elements from the original list. The order of elements in the new list should be the same as in the original list
void main() {
List<int> originalList = [1, 2, 3, 2, 4, 1, 5, 3];
List<int> uniqueList = originalList.toSet().toList();
print("Original List: $originalList");
print("Unique List: $uniqueList");
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_22.dart | //Given a map representing a shopping cart with keys as product names and values as quantities, write Dart code to check if a product named "Apple" exists in the cart. Print "Product found" if it exists, otherwise print "Product not found"
void main() {
Map<String, int> shoppingCart = {
'Apple': 2,
'Banana': 3,
'Orange': 1,
};
if (shoppingCart.containsKey('Apple')) {
print('Product found');
} else {
print('Product not found');
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_19.dart | //Given a map representing a product with keys "name", "price", and "quantity", write Dart code to check if the product is in stock. If the quantity is greater than 0, print "In stock", otherwise print "Out of stock"
void main() {
Map<String, dynamic> product = {
'name': 'Apple iPhone',
'price': 200.00,
'quantity': 5,
};
int quantity = product['quantity'];
if (quantity > 0) {
print('In stock');
} else {
print('Out of stock');
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_11.dart | //Write a Dart code that takes in a list and an integer n as parameters. The function should return a new list containing the first n elements from the original list.
void main() {
List<int> originalList = [1, 2, 3, 4, 5, 6, 7, 8];
int n = 3;
List<int> resultList = originalList.take(n).toList();
print("Original List: $originalList");
print("First $n elements: $resultList");
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_5.dart | //Create a map with name, phone keys and store some values to it. Use where to find all keys that have length 4
void main() {
Map<String, String> contacts = {
'Aamir': '123-456-7890',
'Zain': '234-567-89071',
'Naveed': '345-678-9912'
};
var keysWithLength4 = contacts.keys.where((key) => key.length == 4);
print(keysWithLength4);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_9.dart | //Given a list of integers, write a dart code that returns the maximum value from the list.
void main() {
List<int> numbers = [10, 5, 7, 15, 3, 20, 9];
int maxValue =
numbers.reduce((value, element) => value > element ? value : element);
int minValue =
numbers.reduce((value, element) => value < element ? value : element);
print("Maximum value: $maxValue\nMinimum value: $minValue");
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_6.dart | //Create Map variable name world then inside it create countries Map, Key will be the name country & country value will have another map having capitalCity, currency and language to it. by using any country key print all the value of Capital & Currency
void main() {
Map<String, Map<String, String>> world = {
'Pakistan': {
'capitalCity': "Islamabad",
'currency': 'PKR',
'language': 'Urdu',
},
'India': {
'capitalCity': "New Delhi",
'currency': 'INR',
'language': 'Hindhi',
},
'Iran': {
'capitalCity': "Tehran",
'currency': 'IRR',
'language': ' Farsi',
},
'Turkey': {
'capitalCity': "Ankara",
'currency': 'TRY',
'language': 'Türkçe',
},
};
String country = 'Pakistan'; // change this to any country you want
print('Capital City of $country: ${world[country]?['capitalCity']}');
print('Currency of $country: ${world[country]?['currency']}');
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_10.dart | // Write a Dart code that takes in a list of strings and removes any duplicate elements, returning a new list without duplicates. The order of elements in the new list should be the same as in the original list
void main() {
List<String> originalList = [
'apple',
'banana',
'orange',
'banana',
'kiwi',
'apple'
];
List<String> uniqueList = originalList.toSet().toList();
print("Original List: $originalList");
print("Unique List: $uniqueList");
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_14.dart | //Write a Dart function named sortList that takes in a list of integers and returns a new list with the elements sorted in ascending order. The original list should remain unchanged.void main() {
void main() {
List<int> originalList = [5, 2, 8, 1, 3];
originalList.sort((a, b) => a.compareTo(b));
List<int> numbers = originalList;
print(numbers);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_4.dart | // Create a list of numbers and create one empty list, now check for every index number is EVEN or ODD. if number is even then add true into empty list and if number is odd then add false into empty list, both list needs to print at the end
//without using loop
void main() {
List<int> numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];
List<bool> results = [];
numbers.forEach((number) {
if (number % 2 == 0) {
results.add(true);
} else {
results.add(false);
}
});
print(numbers);
print(results);
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-2/Question_12.dart | //Write a Dart code that takes in a list of strings and returns a new list with the elements in reverse order. The original list should remain unchanged
void main() {
List<String> originalList = [
'apple',
'banana',
'orange',
'Mango',
'Pineapple'
];
List<String> reversedList = originalList.reversed.toList();
print("Original List: $originalList");
print("Reversed List: $reversedList");
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-1/Question_8.dart | /*---------------SMIT FLUTTER ----------------*/
void main() {
//Create a marksheet using operators of at least 5 subjects and
//output should have Student Name, Student Roll Number, Class, Percentage, Grade Obtained etc.
//i.e: Percentage should be rounded upto 2 decimal places only?
String studentName = "Aamir Siddique";
int rollNumber = 001;
String className = "11th";
// Marks obtained in each subject
int englishMarks = 85;
int mathMarks = 92;
int scienceMarks = 78;
int historyMarks = 88;
int computerMarks = 90;
// Total marks for each subject
int totalMarks = 500;
// Calculate the total marks obtained
int totalMarksObtained =
englishMarks + mathMarks + scienceMarks + historyMarks + computerMarks;
// Calculate the percentage
double percentage = (totalMarksObtained / totalMarks) * 100;
// Round the percentage to 2 decimal places
percentage = double.parse(percentage.toStringAsFixed(2));
// Determine the grade based on percentage
String grade;
if (percentage >= 90) {
grade = 'A+';
} else if (percentage >= 80) {
grade = 'A1';
} else if (percentage >= 70) {
grade = 'B';
} else if (percentage >= 60) {
grade = 'C';
} else if (percentage >= 50) {
grade = 'D';
} else {
grade = 'F';
}
// Print the marksheet
print('Student Name: $studentName');
print('Roll Number: $rollNumber');
print('Class: $className');
print('Total Marks Obtained: $totalMarksObtained');
print('Total Maximum Marks: $totalMarks');
print('Percentage: $percentage%');
print('Grade Obtained: $grade');
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-1/Question_3.dart | /*---------------SMIT FLUTTER ----------------*/
void main() {
//A student will not be allowed to sit in exam if his/her attendance is less than 75%.
//Create integer variables and assign value:
//Number of classes held = 16,
//Number of classes attended = 10,
//and print percentage of class attended.
//Is student is allowed to sit in exam or no?
int classesHeld = 16;
int classesAttended = 10;
double attendancePercentage = (classesHeld / classesAttended) * 100;
print("Attendance Percentage: ${attendancePercentage}%");
if (attendancePercentage >= 75) {
print("The student is allowed to sit in the exam.");
} else {
print("The student is not allowed to sit in the exam.");
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-1/Question_7.dart | /*---------------SMIT FLUTTER ----------------*/
void main() {
//Write a program to calculate and print the Electricity bill of a given customer.
//Create variable for customer id, name, unit consumed by the user,
//bill_amount and print the total amount the customer needs to pay.
//The charge are as follow
int customerId = 1001;
String customerName = 'James';
int unitsConsumed = 800;
double billAmount;
if (unitsConsumed <= 199) {
billAmount = unitsConsumed * 1.20;
} else if (unitsConsumed >= 200 && unitsConsumed < 400) {
billAmount = unitsConsumed * 1.50;
} else if (unitsConsumed >= 400 && unitsConsumed < 600) {
billAmount = unitsConsumed * 1.80;
} else {
billAmount = unitsConsumed * 2.00;
}
print('Customer IDNO: $customerId');
print('Customer Name: $customerName');
print('Unit Consumed: $unitsConsumed');
print('Amount Charges @Rs. 2.00 per unit: $billAmount');
print('Net Bill Amount: $billAmount');
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-1/Question_1.dart | /*---------------SMIT FLUTTER ----------------*/
void main() {
//Create two integer variables length and breadth
//and assign values then check if they are square values or rectangle values.ie:
//if both values are equal then it's square otherwise rectangle
int lenght = 12;
int breadth = 12;
if (lenght == breadth) {
print("It's Square ");
} else {
print("It's Rectangl ");
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-1/Question_2.dart | /*---------------SMIT FLUTTER ----------------*/
void main() {
//Take two variables and store age then using if/else condition to determine oldest
//and youngest among them
int age1 = 25;
int age2 = 30;
if (age1 > age2) {
print("Age 1 is the oldest");
print("Age 2 is the youngest");
} else if (age2 > age1) {
print("Age 2 is the oldest");
print("Age 1 is the youngest");
} else {
print("Both ages are equal");
}
}
| 0 |
mirrored_repositories/SMIT-FLUTTER | mirrored_repositories/SMIT-FLUTTER/assigment-1/Question-4.dart | /*---------------SMIT FLUTTER ----------------*/
void main() {
//Create integer variable assign any year to it and check if a year is leap year or not.
//If a year is divisible by 4 then it is leap year but if the year is century year like 2000, 1900, 2100 then
// it must be divisible by 400.i.e: Use % ( modulus ) operato
int year = 2001;
if ((year % 4 == 0) && (year % 100 != 0 || year % 400 == 0)) {
print('$year is a leap year.');
} else {
print('$year is not a leap year.');
}
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.