Skip to content

Commit

Permalink
Merge pull request #2 from leoelstin/master
Browse files Browse the repository at this point in the history
15 updates on master repo
  • Loading branch information
Princeallan committed Mar 22, 2020
2 parents a74febf + 2970ca7 commit 6d16efb
Show file tree
Hide file tree
Showing 20 changed files with 614 additions and 8 deletions.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@
### Flutter UI Kits

This project contains various inspired UI kits purely coded in Flutter framewrok.
This project contains various inspired UI kits purely coded in Flutter framework.

### Animated BottomBar ([Fancy Bar v1.2.0](https://pub.dev/packages/fancy_bar#-readme-tab- "Fancy Bar v1.2.0"))

Available as a seprate Package @pub
Clone the project [here.](https://github.com/leoelstin/fancy_bar "here.")

### V1
![alt text](https://raw.githubusercontent.com/leoelstin/Flutter-UI-Kits/master/images/ezgif.com-crop.gif)

### V2
![alt text](https://github.com/leoelstin/Flutter-UI-Kits/blob/master/images/fancy_bar_v2.gif?raw=true)

An animated bottom bar with AnimatedSwitcher.

Sample Code ::

InkWell(
onTap: () => setItem(3),
child: Container(
width: 100,
height: 55,
alignment: Alignment.center,
child: AnimatedSwitcher(
transitionBuilder:
(Widget child, Animation<double> animation) {
return ScaleTransition(
scale: animation,
child: child,
);
},
duration: Duration(milliseconds: 250),
child: pos == 3
? Text('Profile',
style: TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
fontSize: 18))
: Icon(Icons.account_circle),
)),
),


### Wallpaper UI Kit
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animated_bottom_bar.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ezgif.com-crop.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fancy_bar_v2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions lib/animation/animated_bottom_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:fancy_bar/fancy_bar.dart';
import 'package:flutter/material.dart';

class AnimatedBottomBar extends StatefulWidget {
static String tag = 'animatedBottomBar';

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

class _AnimatedBottomBarState extends State<AnimatedBottomBar> {
int pos = 0;

void setItem(int _pos) {
setState(() {
pos = _pos;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(''),
),
bottomNavigationBar: FancyBottomBar(
type: FancyType.FancyV2,
items: [
FancyItem(
textColor: Colors.orange,
title: 'Home',
icon: Icon(Icons.home),
),
FancyItem(
textColor: Colors.red,
title: 'Trending',
icon: Icon(Icons.trending_up),
),
FancyItem(
textColor: Colors.green,
title: 'Search',
icon: Icon(Icons.search),
),
FancyItem(
textColor: Colors.brown,
title: 'Settings',
icon: Icon(Icons.settings),
),
],
onItemSelected: (index) {
print(index);
},
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
13 changes: 7 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_widgets/form_kit/flutter_form.dart';
import 'package:flutter_widgets/wallpaper_kit/pages/home_page.dart';
import 'grocerry_kit/welcome.dart';
import 'package:flutter_widgets/animation/animated_bottom_bar.dart';
import 'package:flutter_widgets/note_app/edit_note.dart';

import 'grocerry_kit/auth.dart';
import 'grocerry_kit/phone_verify.dart';
import 'grocerry_kit/home_page.dart';
import 'grocerry_kit/phone_verify.dart';
import 'grocerry_kit/sub_pages/cart.dart';

void main() => runApp(MyApp());
Expand All @@ -21,13 +21,14 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.amber,
),
routes: {
'/': (context) => WallHomePage(),
'/': (context) => AnimatedBottomBar(),
'/grocerry/auth': (context) => AuthPage(),
'/grocerry/verify': (context) => VerifyPage(),
'/grocerry/home': (context) => HomePage(),
'/grocerry/cart': (context) => CartPage(),
AnimatedBottomBar.tag: (context) => AnimatedBottomBar(),
EditNote.tag: (context) => EditNote(),
},
);
}
}

65 changes: 65 additions & 0 deletions lib/note_app/controller/notes_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:flutter_widgets/note_app/dto/notes_dto.dart';
import 'package:flutter_widgets/note_app/service/notes_service.dart';

class NotesController {
NotesService _notesService;

static final NotesController _singleton = NotesController._internal();

factory NotesController() {
return _singleton;
}

NotesController._internal() {
_notesService = NotesService();
}

Future<List<NotesDto>> getNotes() async {
try {
String response = await _notesService.getNotes();
debugPrint(response);
return notesDtoFromJson(response);
} catch (e) {
throw e;
}
}

Future<String> deleteNote(String noteID) async {
try {
String response = await _notesService.deleteNote(noteID);
debugPrint(response);
return '';
} catch (e) {
throw e;
}
}

Future<String> createNotes(String title, String content) async {
try {
Map<String, dynamic> map = {
'title': title,
'content': content,
};
String response = await _notesService.createNote(map);
debugPrint(response);
return '';
} catch (e) {
throw e;
}
}

Future<String> updateNote(String id, String title, String content) async {
try {
Map<String, dynamic> map = {
'title': title,
'content': content,
};
String response = await _notesService.updateNote(id, map);
debugPrint(response);
return '';
} catch (e) {
throw e;
}
}
}
51 changes: 51 additions & 0 deletions lib/note_app/dto/notes_dto.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// To parse this JSON data, do
//
// final notesDto = notesDtoFromJson(jsonString);

import 'dart:convert';

List<NotesDto> notesDtoFromJson(String str) =>
List<NotesDto>.from(json.decode(str).map((x) => NotesDto.fromJson(x)));

String notesDtoToJson(List<NotesDto> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));

class NotesDto {
String id;
String title;
String content;
DateTime createdAt;
DateTime updatedAt;
int v;

NotesDto({
this.id,
this.title,
this.content,
this.createdAt,
this.updatedAt,
this.v,
});

factory NotesDto.fromJson(Map<String, dynamic> json) => NotesDto(
id: json["_id"] == null ? null : json["_id"],
title: json["title"] == null ? null : json["title"],
content: json["content"] == null ? null : json["content"],
createdAt: json["createdAt"] == null
? null
: DateTime.parse(json["createdAt"]),
updatedAt: json["updatedAt"] == null
? null
: DateTime.parse(json["updatedAt"]),
v: json["__v"] == null ? null : json["__v"],
);

Map<String, dynamic> toJson() => {
"_id": id == null ? null : id,
"title": title == null ? null : title,
"content": content == null ? null : content,
"createdAt": createdAt == null ? null : createdAt.toIso8601String(),
"updatedAt": updatedAt == null ? null : updatedAt.toIso8601String(),
"__v": v == null ? null : v,
};
}

0 comments on commit 6d16efb

Please sign in to comment.